I am an aspiring author, but I have written several short 'test novels.' With each of those, it became increasingly clear how you have to develop the main character, the protagonist. After all, the story is about the protagonist. The reader needs to like the protagonist and want him to win, otherwise he will stop reading. Therefore, I am unsure about killing off the protagonist. This is not because I like the character too much, but because the reader might stop reading.
I looked up Killing off a Character, but it didn't quite answer my question: Should you kill off the protagonist. It dealt more with main characters - characters that are important to the novel but not necessarily the protagonist. My question deals more with the hero, the person everyone is rooting for. How can you kill that person without losing the reader? Is it possible at all? Is it even advisable?
Looking over the above linked question, I understand the points being made. Don't make the death meaningless, don't kill someone just because he's in the way, etc. The death has to mean something. But how can you justify anything the death has to prove by killing off the hero, basically the main reason the reader is reading?
This question is especially a problem for first-person novels. If the hero keeps on narrating after death, the reader is probably going to wonder where he is. Heaven? Hell? Did the character die at all?
The only place I could see the hero dying without catastrophic results would be at the very end of the book. If his death can prove something and then the book ends immediately after that... that could work. However, the problem still remains that the reader will doubtless be displeased.
So is it advisable to kill the protagonist? If it is, how can you do so without alienating the reader?
EDIT: After reviewing all of the excellent answers that have been submitted for this question, I feel that most of them each have a part of the answer. If I were to choose one, however, I would have to select the comment supplied by @GreenAsJade on clockwork's answer, which was also very good.