There are a lot of elements that can make or break a book. Terrible dialogue, unlikable characters, predictable story, but the one thing that can truly destroy a successful book is an unsuccessful ending. You could be reading a mediocre book, but when you get to the end and it hits a home run, you will walk away satisfied. On the other hand, when you read a great book that has a terrible ending, it ruins the whole experience. For me, as a writer, there are certain things I always try to do when I come up with an ending for my novels and my short stories.
One thing to do is to try and stay away from an ending that is so typical, one that the reader will see coming a mile away. Give them a hint or two of where you are going, then flip it on them and give them something else.
The next thing is that you don't always have to give them a happy ending. Sure people love those endings where everyone wins and evil loses, but some of the greatest and most memorable stories are tragic. Don't be afraid of hurting people's feelings or be called a nihilist, give them a bit of darkness. After all, letting something bad happen to a main character can do two things to some readers; make them care more for them, and appreciate their own lives. Might sound silly, but it's true.
A big one for me is to try and stay away from what I call "The Dean Koontz Solution". What that is, is when you solve the major problem, save the day and defeat the enemy with a gun. The gun is just too easy, a cop out in a way that is starting to be a cliché as "and then he woke up". Try and be original and the read will respect it more.
Also, make it believable. Ask yourself, if you were that character, would you do that? Does it seem dumb or something no rational person would do? Ask your friends if you can't be objective.
And last, end with a punch. The last line should be memorable, something that echoes after the reader closes the book. Don't rush it and don't drag it out, but try to find that great closer than makes you feel as though you nailed it.