Well, clearly there is a trend. Since my name is John, I also must answer the question.
My favorite endings in books come from a list a little different from what the worthies named above listed. This could be due to age, or taste, or some other factor. Maybe I have a penchant for surprise endings.
At the risk of seeming spoileriffic, allow me to list (in no particular order. I am using a count-down because it seems dramatic.)
10. WEAPON MAKERS by A.E. Van Vogt
And vast infinities away, past the Gate of Deeper Slumber and the enchanted wood and the garden lands and the Cerenarian Sea and the twilight reaches of Inquanok, the crawling chaos Nyarlathotep strode brooding into the onyx castle atop unknown Kadath in the cold waste, and taunted insolently the mild gods of earth whom he had snatched abruptly from their scented revels in the marvellous sunset city.
To the infinite emptiness I/we sent out one last pulse: 'Goodby.'
He drew a deep breath. "Well, I'm back," he said.
"It is pain."
"That, too, I must have known."
He was silent for a few minutes; then he stepped quietly onto the raft. Krag pushed off, and they proceeded into the darkness.
They are in it, I hope, he and his eerie young woman Nettle, the old sybil, and their bird, on course upon a greater sea to strange new islands. Good fishing! Good fishing! Good fishing! Good fishing!
And the particular favorite ending of mine, hailing the very earliest days of the scientific romance genre.
1. WAR O F THE WORLDS by HG Wells
Allow me to quote at length:
For so it had come about, as indeed I and many men might have foreseen had not terror and disaster blinded our minds. These germs of disease have taken toll of humanity since the beginning of things— taken toll of our prehuman ancestors since life began here. But by virtue of this natural selection of our kind we have developed resisting power; to no germs do we succumb without a struggle, and to many—those that cause putrefaction in dead matter, for instance —our living frames are altogether immune. But there are no bacteria in Mars, and directly these invaders arrived, directly they drank and fed, our microscopic allies began to work their overthrow. Already when I watched them they were irrevocably doomed, dying and rotting even as they went to and fro. It was inevitable. By the toll of a billion deaths man has bought his birthright of the earth, and it is his against all comers; it would still be his were the Martians ten times as mighty as they are. For neither do men live nor die in vain.
This is the very model and exemplar of what a science fiction ending should be. Whether it makes a satisfying ending to a thriller, or a war-story, or a drama, or a romance, I leave to others better qualified to decide. But science fiction has unique requirements shared by no other genre, not even fantasy or horror. Not only must a science fiction story, to be properly science fiction, invent a fictional but plausible world, it must rest for its plausibility on the verisimilitude of science, a speculation, no matter how far fetched, that is part of the scientific world view. This means the dramatic climax, to be satisfying as science fiction, must be a logical yet unexpected application of some scientific principle advanced earlier in the plot.
In this case, the scientific principle was Darwinism, which was new and fresh when Wells wrote. Darwinian science did not say that evolution might produce creatures superior to man through natural selection on older worlds than ours--but this is a valid scientific speculation which holds a tinge of awe in it. For what if it were so? If it were so, then mankind is not necessarily the fittest to survive. As in Wells' romance, we might be little more than food-animals for these beings. We could not prevail no matter our valor.
But the surprise ending is that Darwin's Natural Selection is a neutral and heartless judge, and 'fitness to survive' does not mean superiority either of intellect, or technology or anything else humans call superior. This is a point Wells grasped (which many writers who romanticize Darwin, such as Hegel and Nietzsche, do not grasp). Humans in this book prevail because we are more fit to survive on Earth, since we have evolved a disease resistance here, which the superior Martians, having long ago wiped all all germs and morbid bacteria on their globe, had no reason to think to be a threat.
Wells here draws out not one, but two surprising and imaginative speculations from Darwin's work, and does it expertly enough that it is one of the standard stereotyped tropes, perhaps the main and most well known trope, of the science fiction genre. The first thing a non-SF reader thinks about when he thinks of sci-fi is of big-headed alien invaders with ray guns--that is to say, the speculation that evolution could produce a superior.
HG Wells here produces the standard science fiction ending against which all science fiction endings -- in so far as they are scientifictional as opposed to merely dramatic or entertaining -- should be judged. It is the footprint of the king that decides the measure of the foot in the kingdom.