We give birth to characters. We give them life. We grow up with them. We give them back stories. We get inside their heads and they become a part of us. And then we kill them.
Because they annoy us? Because it's their time to die? Because it's necessary in order for the plot to continue? Or simply for a shock tactic that will keep readers/viewers interested?
A character's death should serve a purpose. Okay, sometimes that purpose is to not have a purpose. Sometimes killing off a character simply for shock value can be a great way to breathe new life into a piece, but only if done well. Generally character deaths should give birth to something else, no? We can't just go around killing off character after character. Spooks quickly got into the habit of introducing characters just to kill them off and generally it's more of a shock if a character survives.
Like everything else in writing there's no exact formula for killing off characters. I know there are many examples where it works brilliantly and many where it doesn't. We can all think of a TV series where they kill off one of the audience's favourite characters. Sometimes it works. Often it reduces the audience.
I think the best way to know if a character has been killed off well is if we regret their death but we don't regret the decision to write them out. If done expertly, we actually mourn these fictional people's deaths. We feel like we want to go into their world and save them and yet, we know the piece is better for their death. We know that these raw feelings that have been awoken in us should be treasured. For fiction to make us feel like this is phenomenal. We're glad and yet we love these characters. We want them to survive. We want them to have happy endings.