I read something recently that Socrates was killed because he supported the wrong political faction during a time of conflict. When their enemies gained power they exacted revenge by framing him by accusing him of impiety and corrupting the youth (won't somebody think of the children?). Besides they gave him an out (exile), which he declined so he chose martyrdom and the rest is history as they say. But at this remove, who knows. Can't for the life of me remember where I read that or I'd post a link.
I heard it was because some of his students rebelled against the government, took over and ended up acting as tyrants for a certain amount of time. So he kind of got the blame for their actions, as the one who 'inspired' them.
I imagine he doesn't get called a gadfly for nothing. The only Platonic dialogue I can stand is The Symposium because Socrates' method of interrogation is elsewhere too annoying†. Maybe instead of "don't feed the trolls" we should say "don't feed the gadflies".
† Having said that, I recently got out of the library Heyting's _Intuitionism: An Introduction_ and it's in fictional dialogue format initially which irritated me no end. (So maybe it's not Socrates but the form!) I guess I don't appreciate it as a teaching method but I can see why it is used especially if otherwise there would be a lot of back-and-forth question-response type segments in the text. Not a fan :)
This post gives me words to express what I always thought: They killed Socrates for trolling.