I think that a good ending is an emotionally satisfying ending. It doesn't matter if it's a happy ending or a tragic ending, as long as it makes sense in retrospect and is consistent with the narrative. Lovecraft stories almost always end in some kind of a tragedy, but they stay very consistent with the theme of cosmic horror and wonder at the boundless, uncaring universe, from the beginning to the end. Tolkien's endings for his major works similarly end in a somewhat predictable way, too, a mix of victory at a great cost, a sense of loss, and hope that in the end, things will be amended. "Children of Hurin" is a great example of this, I think. I hated what happened in that story, but I loved hating it, too. It was very emotionally satisfying.
Talking more about satisfying video game endings, Bioware has examples of doing it just right and doing it as badly as possible. The first Dragon Age game had multiple endings, all logical in retrospect and all emotionally satisfying. It was a game where you had to make choices, and then you faced the repercussions down the line. Then something happened, fastforward to Mass Effect 3, another game where the main theme is making choices and defying immeasurable odds, but the writer literally has a god decide your fate in the last 5 minutes of the game. Now, if the narrative was about being constantly controlled by forces outside of your control and only postponing the inevitable (kind of like Lovecraftian stories), that would have probably been a reasonably emotionally satisfying ending, actually.
The bottom line? Figure out what theme you want to explore, and stick with it. When the ending rolls around, a reader must be able to see how in retrospect, it made sense, and the ending feels like it finishes exploring the theme in some way. It's one with the theme. Dr. Linda Seger said that a lot of works fail because when they try to pull a twist at the end, it just doesn't work, because twists are difficult to achieve so they make sense in retrospect. Just think of successes and failures of M. Night Shyamalan. I hope this helps.