However, many praised works of literature don't necessarily end up that way. The Great Gatsby ends with a lot of death. In Wuthering Heights, everyone is miserable, crazy, or dead. Winston Smith is tortured and defeated at the end of 1984. Despite our love and desire for happy endings, many of the books that are praised do not end on a happy note.
To me, this contrast is interesting. As a society, we're conditioned to desire the happy ending, so you think that would be reflected in the things that we are reading. In fact, though many popular and beloved classics don't end happily, their movies end happily. The BBC wrote an article a few years ago that points out the changes in the movie adaptations to make them more happy, coining it the "Hollywood Happy Ending." And many big blockbuster Hollywood movies do end up this way; as one of my friends say, you'll know it's an indie movie if it doesn't have a happy ending.
All in all, I personally enjoy books (and movies!) that might have more of a tragic or open ending. I believe that these are fodder for discussion afterwards. If a book ends in a way that makes you keep thinking, that makes you want to come back and read it again, then that's the mark of success for me. Like Eleanor & Park by Rainbow Rowell. Or Every Day by David Levithan. They insight discussion, and make you want to come back again.
When reading, do you prefer to have happy endings?