Silent Hill 2 (pictured left) had one of the most satisfying endings videogames have to offer. Most videogames rush through endings in 5 to 10 seconds that aren't enough time to let you enjoy your successes and instead leave you thinking: "Is that it?". Silent Hill 2's endings gave you time to savor it and the endings were also influenced by subtle, long-lasting, and meaningful actions such as how often you stare at the picture of your dead wife, or the knife in your inventory, or how long you spend time with Maria (your false wife). This gave the endings greater credibility as they were influenced by how you played. All of the endings very much fit within the tragic framework of the game. The best you could hope for was a bittersweet ending.
So let's break down the elements of a satisfying conclusion in a pen and paper game as they aren't far off from that. Bear in mind that an adventure, or campaign, can end with none of these elements and still be all right. This is all about the ideal ending in the ideal world. Also be aware that sandbox games don't tend to have 'endings' as such although they may still have 'concluding points' to certain arcs that may still benefit from what is mentioned below.
A good ending is...
...created by the characters' actions. While you can get a lot of mileage out of a pre-written ending that is little affected by the players (like the Big Bad at the end of the dungeon) it's always more thrilling when the player's actions are meaningful. In that aforementioned dungeon, if the characters stealth it through than have a thought about how that might affect the encounter. Perhaps a surprise round? A chance to ambush it? A chance to overhear its confusion at the loss of all of its minions or its fears at being hunted by an invisible monster? If they use stealth and tactics to make their way through and it is perfectly aware of them and unaffected by their choices than it undermines the value of those choices.
...relevant. So you've spent most of the adventure chasing the criminals who killed your wife before the story gets side-tracked to be about a tangentially related (but more powerful enemy) vampire who has been blood addicting police officers around town. If you find such a tangent developing, your best bet isn't to slam the characters back onto the right path or to dry up leads to the vampire. Your best bet is to adjust the storyline so that the vampire becomes more relevant to their original plot line - perhaps the wife killing criminals are all ghouls or even hunters who have been stalking the vampire.
...captures the mood of the piece. While you can certainly contrast a desperate and tragic mood with an up beat and exciting mood, it is hard to pull off. Perhaps the denouement (the bit after the End where they get their rewards and tie up the loose ends) could use a mood shift but otherwise it can give a bit of mood whiplash. While it may be enjoyable in its own right, it won't have the sense of pacing and progress that it would if the tension were amped up within the original mood.
...follows a dangerous low point. The characters have some wins and losses under their belt but right now things are at their lowest ebb. Their lives are at real risk. The police are on their heels. The monster is about to release the fatal disease and now is the time the characters must act. Perhaps for a moment they thought all was lost until they realised that the enemy can be defeated by salt water and they're surrounded by an ocean. A touch of despair followed by a tonne of hope can really bring out the excitement in an adventure. Just don't let it go on for too long or else futility sets in.
...is more engaging than any earlier point. If you begin an adventure with the Titanic crashing and their frantic attempts to escape than you've got your work cut out for you to create an appropriate ending out of a local fishing village wife threatening them with a knife. You're luckier in a roleplaying game because danger and tension aren't the most memorable weapons in your armoury like on a movie ... human emotion is. If you can get them to care about the situation, you will arrest their attention in a way that car chases and explosions never could. Take that fish wife, for example. If the players relate to her and talk her down and care about the situation than they will talk about her long after the Titanic has slipped from their memory.
...provides worth-while rewards. I don't just mean experience points although a convenient level up can be nice as well. Rewards can be acknowledgement from society, respect from a rival, congratulations from respected figures, land, title, a grateful and safe loved one, social change, a return to normality, promises of future favors, or even the tragic and terrible corruption and death of the characters. Hey, different strokes for different folks. Some players just want to see their characters crash and burn.
...provides a little wind down time. Let the characters high five and laugh with relief. Let the married couple reunite. Let the mother tuck her safe children into bed. Let them roleplay their success (or their horrible failure, death and self-destruction) so that they get to bask in the ending. On that note, don't let it get too drawn out or else they may end on a boring note rather than a fun one. If necessary, end the game a little early or at least call a break so people can bask in the glory out of character for a few minutes before jumping into the next adventure or arc.
So there you are. Obviously other elements matter, and all the basics of a good adventure count as well, but these are the main ones I can think of. Can you think of any more?
The main Endings article (and all the various links) can be found over here.