While writing your story, you are making certain promises to your reader. Some of those promises are inherent in the genre you're writing: if you're writing a murder mystery, you promise the reader will learn who did it and why; if it's a romance, you promise the right people will get together in the end. (Mostly. You can break these rules, but you should know what you're doing first).
But genre aside, every story makes promises, and it's your job to give the reader what they want. That doesn't mean you have to be predictable, but throw in the wrong kind of twist and your reader will toss your book across the room in frustration.
Let's look at an example. Halfway through Back to the Future, everything's set up for a big climax. The two major conflicts (will Marty get back to the future? can he get his parents together so he still exists when he gets there?) are set up so that Marty's only chance at both is at the same time: the night of the Enchantment Under the Sea Dance. How does this have to end? You might think there are a thousand ways it could end--after all, anything's possible--but the truth is that the viewer is expecting a very limited subset of what is possible.
In BttF, the viewer expects Marty to get home and his parents to get together. Why? Because it's a light-hearted, funny movie. From the very beginning, the movie sends subtle clues that this will be a fun story, which implies a happy ending. There are a number of twists that can happen, but if Marty dies in the end, or gets stuck in the past forever, the viewer will be upset.
BttF also sent signals about what kind of climax it would be. Because there are action scenes (the Libyans attacking Doc Brown, Biff and his goons chasing Marty), the reader expects not just similar, but bigger, action for the climax. Because the movie is funny, we expect a little comic relief from the climax (or at least aren't blind-sided when it happens).
There's more. Marty's dad didn't have to become confident, did he? Could Marty have gone home and found everything exactly as he left it--loser parents and all? He probably could have, but we're all glad he didn't. The viewer expects the characters they care about will not only win, but win big (or, if it's a tragedy, lose big). It's not enough for George McFly to get the right girl, he has to become more than he was before Marty interfered. Marty doesn't just come back home, he comes back to something better (a new truck, Doc Brown lives and is a closer friend to him than ever).
Not all endings have to be happy and predictable, but they have to be satisfying. They have to be bigger and better than anything that's happened in the book so far. If you twist it, the twist should be better than the straight-forward ending would have been--don't twist just to be unpredictable.
Ask yourself, what has to happen in the end? Twists and details aside, where do the characters have to end up for me to be satisfied? That's where the ending needs to go.