That will likely be the last Star Trek reference I make - in this entry, anyway, and only because I can't think of any other way to tie Star Trek into this particular topic. My geekdom knows few bounds. But the death of the redshirts (okay, so that's another reference) doesn't really apply to the topic today, despite the high turnover rate in their ranks.
While this is about people who die and stay dead, it's also about when significant characters die and stay dead. Not the incidentals or the guest stars. There can be any number of reasons why an important character might die, not all of which are good reasons, if you ask me.
The first reason, and the best, is when it's necessary to further the story. Sometimes it's just necessary for someone to die. If you write horror or mystery, this is probably a given. Most murder mysteries circumvent this some because the character usually starts dead, or is given only a brief introduction before being killed. (Unless you're in one of those Agatha Christie type stories where people are slowly but surely killed off.) They become a central character of sorts because they're dead. In contrast, in a horror story characters tend to die to illustrate the idea that no one is safe. Sometimes, though, someone simply has to die. Would Luke have put his faith in the Force during the Death Star run without the death of Obi-wan? Possibly, but likely not, and it would have carried much less gravitas to have Obi-wan telling Luke to "Use the Force" over the intercom.
Sometimes a character dies simply because the writer has run out of uses for them. They create a character who serves a purpose the plot, but then it becomes murky as to what purpose the character continues to serve once they've fulfilled their function. I happen to think that killing off such a character represents poor planning on the part of the author, and that killing them is the easy way out. Rather than having figured out how to integrate the character into the whole story, they only plotted it out so far, and when things got difficult they pushed the character out of the moving vehicle and into traffic. There are times when this gives the story a bit more of a realistic feel, especially if the death of the character taints the "happy ever after" of the ending, but they can irritate me some when they happen.
What really irritates me, though, is when characters are killed for no good reason other than shock value. An instance that comes to mind is Sirius Black in the Harry Potter series. Dumbledore, too, to a certain extent, although I think that falls more into the second scenario detailed above - the final battle needed to be Dumbledore-free so he couldn't somehow save the day, and killing him off is the surest way to accomplish that. Also set up the whole thing with Snape. However, it was somewhat undermined by Sirius's death in the previous book.
After the fourth installment, it felt to me as if J.K. Rowling felt the need to end the next two books with a death. (The final book was a series of deaths in and of itself, and, honestly, most of those took the easy way out. I didn't feel the loss of any of them, really, except Hedwig.) Sirius was probably the logical choice, by which I mean the biggest shock value. May also have been a case of not knowing what to do with him, though I think that could have been solved. I didn't feel it served any purpose to kill all of Harry's family (except the Dursely's... and really, if there were people who needed killing...) other than just the shock value.
It seemed to me that by killing the character the author in fact marginalized the character. Just watch the movies and this becomes apparent. Other than to die in the fifth installment, what else did Gary Oldman really have to do? And there was a great deal of potential in the character, particularly as a darker foil to Harry, someone he looked up to who wasn't the ideal of the other mentor figures in the book. (Course, maybe that was sort of the moral point. In which case I really dislike his death.)
The Harry Potter series aren't the only case of killing a character for shock value with no other discernible purpose, but it was the one that came to mind. So I guess the moral of the story here is, if your character is going to stay dead, it ought to be for a good reason and not because you wrote yourself into a corner, or wanted to shock the audience.
Death with a purpose, in other words.
There's a third part to this series, and I'll put it up as soon as I remember what it was going to be.