On TVD, I thought all deaths were okay, except for Tyler's. That was so random and unnecessary and not deserved after everything he had been through. Tyler deserved better than that and trying to "make" Damon bad again by killing Tyler was lame. Plec just can't comprehend that death isn't always a way for a character's closure. Tyler could've still appeared in the finale at Matt's ceremony like he did as a spirit but actually alive. Nobody asked for more for Tyler's character. We could have just assumed that he had a normal human life away from Mystic Falls. It's fine closure.
As of TO, many deaths occurred due to actors wanting to leave the show: Kaleb/Kol's, Eva/Rebekah's, Mikael's, Aiden's. Davina's death in S3 was also because her actress wanted to leave. As of the leads' deaths, it was clearly because Plec wanted to give permanent closure to these characters in a way that would make sense for Legacies to exist and for them to not appear on it. Interestingly, Hayley was always supposed to die in Plec's mind, the original idea for TO was for Hayley to have died at the end of S1, leaving Klaus, Elijah and Rebekah to raise Hope in New Orleans. Plus, Phoebe Tonkin (Hayley's actress) didn't want to return for S5, hence she only appeared in a few episodes. Klaus and Elijah both dying was an exaggeration, Elijah sucking all of the Hollow and killing himself would have been much better, he basically had no reason to live, his love Hayley was gone, he had helped Klaus find redemption, and since someone had to die to destroy the Hollow, it'd be more fitting for solely Elijah to die.