A good ending needs two things:
- inevitability (the feeling that this is what everything leads up to)
- offers closure (the satisfaction feeling)
And a great ending needs one more:
- unexpected (the 'what? I didn't see that coming!')
Inevitability is the momentum you've built up over the course of the story into your climax and ending. It's the feeling in the reader that this is the only way things could have worked out. This means the 'easy' solutions to conflict are dealt with in some logical way. If the problem can be resolved with a frank conversation between the right people, you don't have a solid conflict.
Stay in tune with your protag's motivations: also known as staying 'in character.' The protag and antag of your story have their own histories, their own wants and desires. They need to constantly strive for those desires or the reader can't root for them. If Jimmy wants juice but keeps asking for water and then complaining about it, your reader has no sympathy for him. Replace 'juice' with anything your character wants: love, recognition, power, a puppy, revenge- as long as he strives for his goal throughout the story, you'll build the momentum necessary for an inevitable ending.
Reflect the beginning of your story in the end. Either mimic or oppose the situation you started with to evoke either coming full circle or growing beyond one's starting place. Your protag's motivations can help you identify which of the two would feel better. If your protag wants something back the way it was, a circular ending will feel conclusive. If she wants something to change (and gets it) an opposite ending will reflect that.
The protag's direct actions need to result in the ending. Have you ever read a book where at the very moment of crisis something comes out of the blue to save the heros? This is a technique called Deus Ex Machina- a latin phrase for 'god in the machine.' It means, essentially, that the protag hasn't caused his own ending which means all of that momentum you've built up means nothing. Of a cascade of coincidences solves the major conflict of the story, your reader will be cheated of their feeling of satisfaction. The protag needs to kill the king himself, needs to rescue the little girl, needs to master his power through his own force of will. Arbitrary coincidence can't do it for him.
Bring conflict to its full conclusion. The easiest way to cheat your reader of a satisfying ending, is to skip over consequences. Getting characters in trouble is the fun part, but if there are never any consequences to those actions, what do any of them matter? If your protag kills someone and it doesn't effect him in any way, if his sidekicks don't seem to care, what weight does that action hold? None at all. If the climax of your story involves a deadly battle with a werewolf and he barely survives but then you skip right over how he gets help and lives so you can show happily ever after, you've cut your reader out of half of the emotional arc. Gunshots leave holes, death leaves trauma, marriages are extended relationships- not one-time events. Make sure all of your protag's actions have consequences, good or bad, that you're not skipping over.
If you have everything above, a reader can come away from your story satisfied, having enjoyed the experience. But they may have been able to guess your ending, which leaves some people less-than-thrilled. It's still a good book, but they're not going to rave to their friends about it.
To be truly great, an ending must be unexpected. One way to twist the ending is to defy traditions: genre, age, gender, sexuality, caste, and more. The fantasy genre tends to bring the protag and most of their sidekicks through the plot alive. Kill them all off. Romance sub-plots end where the guy eventually wins over the girl. What if she's asexual or lesbian? The hero's usually the one saving the princess. What if the princess saved herself to rescue the hero? Twists on the inevitable ending your plot drives you toward will surprise your readers. If you plant three or four subtle clues throughout the book, your more astute readers will be very pleased they figured it out.
Throw in your voice below. What other ways have you seen endings twist for that 'wow!' feeling?