In this answer, Amadeus makes the case for happy endings based on their far greater popularity compared to unhappy endings.
This leads me to wonder, what exactly makes an ending "happy"?
Before I go further, though, let me say that talking about a "satisfactory" ending doesn't address this question. Let's take it as read that both happy ending and sad endings can be "satisfactory" or "unsatisfactory". My question is, among satisfactory endings, what, for purpose of assessing the market potential of a piece of fiction, defines a "happy" as opposed to a "sad" ending.
Let us also take it as read that books with unhappy endings can and do sell well sometimes. But it would certainly seem that the deck is stacked against them.
The quintessential happy ending is Cinderella. Poor girl goes to dance, marries prince, lives happily ever after. Cindy is clearly better off in every way at the end of the story than she was at the beginning.
But what about Lord of the Rings, in which Sauron is defeated and the Shire restored but Frodo is so crippled by his trials that he can never live happily in the Shire again, but must pass over the sea from the Grey Havens. Frodo is not better off at the end than he was at the beginning (except perhaps in the religious sense of having achieved a heavenly reward). Is that a happy ending?
What about an ending in which our hero dies saving the world (Tony Stark in End Game, for the sake of an example that is likely to be widely known). Is that a happy ending?
Is any ending in which the protagonist experiences a moral triumph, regardless of their physical or emotional circumstances an happy ending?
Given a story in which the heroine does something very wrong which causes several deaths, but then makes a sacrifice that prevents something even worse from happening. Would you say that that is a happy ending? (This one is personal for me.)
Or do we need it to be "happily ever after"?
I am sure we all have our personal preferences, but is there any psychological or commercial theory or study that would define what "happy ending" means for the publishing industry and/or the reading public.