It's hard to say in abstract, but here are a few thoughts I definitely have about endings of stories.
1) A story that has not previously been good can't redeem itself with a well written ending. If I'm not invested in the story or the characters because they have not previously been compelling, I probably won't care much about what happens in the ending, assuming I even make it that far.
2) I dislike happy endings that are artificially created by outside forces, such as time travel to fix things, or resurrecting people. I find these elements to only be appropriate when the story has consistently conveyed the setting up to that point to be conducive to these elements. In general, I think if characters can't be expected to stay dead when destroyed(or at least when destroyed in the proper way. Bullets might not kill an immortal demon, but there is probably some way to permanently eliminate this being.), their destruction becomes much less powerful and significant.
3) The ending has to appropriately make sense given everything that has occurred. While this seems obvious, it doesn't work out a lot of time. As someone above mentioned, the "EVERYONE DIES" ending is often used when it is not appropriate, although it can be appropriate in some situations.
SPOILER INVOLVING CODE GEASS
In my opinion, if Code Geass season 1 had been the ending of the series with the deaths Suzaku, Lelouch, a lot of other characters, and the failure of the rebellion, it would have been an appropriately tragic ending to the stories of Lelouch and Suzaku as tragic heroes, and significantly better and more powerful than the way the series actually unfolded. Admittedly it would have left loose ends, but I would rather have lived with that than the monotony the series turned into.
4) The ending should make me feel something about it other than "eh, whatever." If the protagonist is tragically destroyed, it should be appropriately depressing. If everyone lives happily ever after, it should be warm and full of relief. This goes strongly with #1.