It's mixed because sometimes, it's deserved, but others, it can be pretty meanspirited.
>! Charlie Harper !< (Two And A Half Men): He was killed off because Charlie Sheen, combined with his dwindling sanity, took umbrage with Chuck Lorre hoping he outlived him. Gee, I wonder why.
>! Chef !< (South Park): He was killed off after because Isaac Hayes seemingly quit the show after they mocked Scientology. Later, we learned he had suffered a stroke and didn't even know he wasn't on South Park anymore until after he recovered. He was forced to tour in poor health because he wasn't getting a steady paycheck from South Park anymore. Scientology is evil, exhibit "ran-out-of-letters."
>! Roseanne Conner !< (Roseanne/The Conners): Ladies and gentlemen, the inventor of "cancelled" as a derogatory term for consequences. Just as her show got revived with excellent ratings, Roseanne fucked everything up when she made a racist tweet. Instead of taking responsibility or apologizing, she tried to pass it off like she was doped up on Ambien. Of course, since the show was named after her, she couldn't get fired without taking the whole show with her, but it wouldn't be fair to the cast and crew who did nothing wrong. So, Roseanne was rebranded into The Conners, and Roseanne was killed offscreen.