Tragic ending, something like "The last of us" the good guys technically win but at what cost? Happy endings are too unrealistic and over rated and not memorable when you watch a movie with a happy ending you forget about it quickly. But a tragic ending? That shit gets stuck in your mind
Your wrong.
The reason people read fiction in the first place is because it is unrealistic. If you did your research you would note that people generally prefer stories with happy endings.
People get pretty unhappy when the hero fails or dies in the end, and why would an author upset the people he is trying to please, especially sense many authors actually enjoy making the fans happy, they enjoy seeing the fans smile.
Plus in stories where the hero dies in the end, I have seen many fanbases, take it very badly to the point that they send the author death threats.
Plus it kills all the development the author has given the characters.
So the real issue is which is more important, a good story, or an unexpected ending.