The (Happy?) Ending
Question: So I have an ending for my book where everything is wrapped up nicely, except that then in the last chapter there is a plot twist that reveals that the world is not saved. Now I was just going to leave the ending a little ambiguous as to whether the heroes will prevail or not, but then I had the idea of the world being destroyed by a character who hasn't done much yet, kind of a Chekhov's gun. Is that too much? Should I just have an open ending or kill everyone just to mess with expectations?:)
There are a couple of factors to consider here.
First, a surprise ending should not undermine what has happened in the story so far, but should be seen as the fulfillment of it. It should render the events more meaningful, not less.
A story is an illustration of how a effective particular approach is when confronted with a particular type of problem or goal. You've spent the entire book showing that the choices your characters make in the face of the challenges you've laid down lead to a particular outcome - in this case it sounds like a successful, perhaps even good, outcome. And the reader needs to see the characters get their reward to know they made the right choices.
Do you really want to then turn around and deliver the message that none of that matters? That the choices and efforts they made, the qualities of character they exhibited, do not matter, because in the end the world gets destroyed anyway?
To me, that sounds like a terribly disappointing if
not cruel ending for your reader. It's like blowing up the beautiful house you've just built for your loving wife, sticking your tongue out at her and yelling, "Sucker!"
You would be making the argument that "life is pointless, so why bother trying?"
Generally, there's only one good reason for an ending that flips the outcome, and that is to pave the way for a sequel. It happens sometimes that you create a really good main character who is driven by a particular need, a hole in his life that he yearns to fill. If, in the course of the story, he ends up satisfying that need, then he becomes useless for the next book - because his drive no longer exists. In cases like that, flipping the outcome in order to restore his drive opens the door for another adventure. The reader can see that the story is just the first act of a longer drama, and that the glimpse of happiness the hero received is just there to give him motivation for the next challenge (a Dividend).
However, if you are destroying the world, there's obviously no chance of a sequel.
Now, there's nothing wrong with writing a tragedy in which everyone dies at the end. But that needs to be set up so that it can be seen as the result of bad choices, ill-conceived actions, mistakes, the hero's character flaws, etc. In that case, you would be leaving the reader with the messages that, "Making these types of mistakes can lead to disaster," a perfectly acceptable message that gives meaning to the tragedy and plays fair with the reader.