There's usually a good narrative reason for a TV character being killed off. It may be that there's simply nothing left to do with them, or that they'd serve the plot and fellow characters much better by being dead than they would alive. Sometimes it's just for the shock factor.
When a TV character is killed off because of the actor, though, then it's more often than not because they've gone on to bigger (if not always better) things, or wish to seek new challenges. But others, it's because they've done some truly terrible things, or been extremely difficult to work with.
Whether they've broken the law or just been a disruptive presence, there's only so much that studios, showrunners, and other cast members can put up with before something has to give, and TV characters have to bite the dust.
11. George O'Malley & Derek 'McDreamy' Shepherd - Grey's Anatomy
Grey's Anatomy has had its fair share of behind-the-scenes drama, including Isaiah Washington using a homophobic slur, and former star Katherine Heigl acrimoniously leaving the show, but neither were actually killed off. Two who were, though, are George O'Malley (T.R. Knight) and Derek Shepherd (Patrick Dempsey).
Knight cited a "breakdown in communication" with producer Shonda Rhimes for his decision to leaving the show, although it was also alleged that Washington directed homophobic slurs at him (something Washington has denied). It seems, then, that Knight was thrown under the bus - quite literally, in fact, with his character O'Malley being hit by a bus and killed.
As for Dempsey, he played the love interest of the central character and was on the show for a decade, and thus seemed pretty bulletproof. The actor has since said he simply wanted to move on to different things, but rumours swirled at the time that he had disagreements with Rhimes, with tabloid talk of him cheating on his wife circling as well.