Two things, well probably more, come to mind. The first comment supports
Matthew/Ugluk's thought that Gandalf (and others) had been at work behind the
scenes, while the second falls in with others and supports the idea that such
surprises are common. In the end I think such moments are less surprise endings
than stories that haven't been told yet.
Much went on in Fangorn that we never saw and as Gandalf said of Merry and
Pippin in, The White Rider:
"They were brought to Fangorn,
and their coming was like the falling of small stones that starts an avalanche
in the mountains. Even as we talk here, I hear the first
rumblings.
The full story of those "mountains," of Fangorn and the
history of the Ents is never told. If it was dealt with in the same detail as
the rest of LOTR, the onset of the Hourns might not seem so unlooked for.
Having just five minutes ago finished a rereading of The Silmarillion (after
more than 20 years), I'm much more willing to think of such moments as holes
waiting to filled with stories. Not only are the events of the War of the
Rings tiny in comparison with the rest of that mythology, but what is more
amazing is how Frodo's quest seems in that telling just as unprovoked and
surprising. A full paragraph outlines the desperate situation of the Captains
of the West before the Black Gates where "they at last looked upon death and
defeat, and all their valour was in vain; for Sauron was too strong." And then
after all of that, we suddenly read, with only a sentence of fanfare before,
that
"Frodo the Halfling, it is said, at the bidding of Mithrandir took
on himself the burden, and alone with his servant he passed through peril and
darkness and came at last to Sauron's despite even to Mount Doom; and there
into the Fire where it was wrought he cast the Great Ring of Power, and so at
last it was unmade and its evil consumed.
In this telling, Frodo's
quest seems come out of nowhere, even though we know the fullness of his
story.
'The council of Gandalf was not founded on foreknowledge of safety for himself or for others,' said Aragorn. 'There are some things that it is better to begin than to refuse, even though the end may be dark.'