Watching Arsenal's championship run in the Premier League completely unravel in the closing weeks of the season (capped yesterday by a 3-0 loss at home to Brighton) [5/20 Edit: followed up with a 1-0 loss to Nottingham bleepin' Forest] brings to mind a certain kind of book. One where the story's enchanting beginning and middle becomes sullied by a lousy ending. There's not that many out there. Usually, a bad ending just tags along behind a badly written story. But every now and then, an otherwise brilliant tale falls flat because the author just can't quite "stick the landing," so to speak.
Stephen King's The Stand, for some reason, stands out as an example for me. I remember reading it in ninth or tenth grade (despite my not being much of a reader back then and the book weighing as much as a cinder block). It had me hooked—for more than a thousand pages. Interesting characters. Intense conflict. A dark, paranormal build-up. And then … plop. I won't spoil the ending here, but suffice to say, King took deus ex machina to a level even a teenager couldn't swallow. Which, to me, left a pall over an otherwise entertaining epic.
So what makes for a good ending to a story? I think there are three main requisites. First, the main arcs—plot and character—have to land on solid ground. Are the conflicts the protagonists faced resolved (whether for good or ill)? Have they been changed (for better or worse)? Have events reached a natural (i.e., organic) conclusion? If not (if, for example, the story concludes with the Hand of the Almighty swooping down to detonate a nuclear bomb, killing off a quarter of the main characters, leaving two others free to return home and start a family), then the ending's going to feel shaky, rushed, unsatisfying. And an otherwise solid story will sink.
Second, does the ending deliver what was promised at the beginning? Note, this doesn't mean a predictable conclusion (in fact, many times, just the opposite). Rather, this requisite is, in large part, tied to the story's genre. If the reader bought a romance, she or he is almost assuredly expecting some kind of a romantic attachment to have been formed by the time the main characters reach the end. If it's a mystery, there needs to be an intelligent solution to the crime. Epic fantasy had darn well better deliver an action-packed, dramatic "big fight."
And finally, are all the loose ends tied off? This one is probably the easiest to fall short on. Have all the problems the author raised either been resolved or else left in a purposeful place of stasis that suggests a likely conclusion. Did Checkhov's gun ever go off?
What all three requisites have in common is that they all embody, in some fashion, the fulfillment of the author's implicit promise(s) to the reader. One of the most important promises being: a solid, satisfying conclusion at the end of the story.