There are a lot of things I’ll try in fantasy, but there’s one plot twist which I would hesitate to touch with a ten-foot sword. That’s the protagonist dying.
I’m prepared for this in plays. Some of my favorite Shakespeare plays are the tragedies, where the protagonist’s personality and the Fates themselves conspire to bring about the sad inevitability. It works in literary fiction as well. But in more mainstream novels, or speculative fiction? It’s much more difficult to pull off there.
Part of the problem is that readers invest their time and emotional energy in a person or that person’s struggle, so they hope that person will win and/or be happy in the end. When that person dies or is murdered, it’s sad at best and a shock at worst. There are three books I've read which ended with the killing of the main character and which I don’t ever want to pick up again – Bernard Taylor’s Charmed Life (depressing), Ben Bova’s Mercury (very depressing) and Ayn Rand’s We the Living (so depressing I wanted to toss the book on the floor and jump up and down on it).
So when does this plot twist work?
1. The main character has accomplished his purpose.
This is usually a peaceful, closure-type ending, e.g. Watership Down. If the character hasn’t accomplished what he set out to do, best not to toss him a deathbed consolation prize. If he dreamed of reaching the summit of Mount Everest, and if he’s lying on the South Col in the final stages of hypothermia, having him experience an epiphany that yes, he’s won just by getting that far is probably not going to work.
2. The main character redeems himself by dying.
My favorite example of this is Bridge on the River Kwai. The main character’s death under such circumstances can be very cathartic, especially if there’s no other way for him to defeat the antagonist(s) without sacrificing his life.
3. The story doesn’t end with the main character’s death.
The “It ain’t over till it’s over” ending, superlatively done in A Song of Ice and Fire. Someone else picks up the banner and the story goes on. Probably the only way a fantasy series can continue after the protagonist falls on his sword - or anyone else’s, for that matter.
4. The character’s death doesn’t go dismissed or unnoticed.
One of the reasons Mercury didn’t work for me. The main character, dying of thirst on the titular planet, dictates his last words to the love of his life, who had married another man. She listens to the recording after his body is found, looks at her son (by the other man) and thinks, “Life goes on.” Not much of an epitaph for the protagonist.
The other characters don’t need to spend the rest of their lives in mourning, but if they never even know about the death(s), the story can come off as very bleak and nihilistic, rather than sadly ironic.
If that sounds cynical on my part, it might be--but I get these vibes from what I believe the show portrayed through its scornful treatment of the characters. Why should we care about them if no one--except possibly those destined to die--learns anything?
Review of Star Trek Voyager: Course: Oblivion
5. The character isn’t resurrected – or isn’t entirely normal again.
There’s one fantasy series which I stopped reading because a main character who died was brought back and seemed fine except for a nightmare or two. If the author does resurrect the character, it shouldn’t be the equivalent of pressing a reset button and having everything back to normal. Stephen King’s Pet Semetary is a great example of this.
I think that's one reason I play hardcore characters in Diablo II. Once they die, there's no coming back.