It is unexpected, perhaps, but foreshadowed early in this chapter and in
preceeding chapters. Gandalf said he would return, and return he
did. We heard all about the huorns earlier in the book. Not every
surprising twist is deus ex machina. Gandalf returning from the dead is
deus ex machina -- the clear and unsubtle intervention of Higher Powers.
The huorns are merely a surprise.
The Higher Powers, I judge, intervene subtly all the time in
Middle-earth. But a true deus ex machina is not at all subtle or
ambiguous. Even the Great Eagles, whose appearances come close to a true
deus ex machina, could have been called or sent by someone like Radagast or
Galadriel.
The term deus ex machina was coined in the Greek theater, where a machine was
used to lower actors playing gods into the play. The Valar, and Eru, do
not make such obvious appearances in LotR. So, strictly speaking, there
is no deus ex machina in LotR. But there are some actions that come close
to advertising the intervention of a Higher Power. The appearance of the
huorns is not, however, one of those
action.
________________________________________
"‘I think he was a silly little man,' said Councillor Tompkins. ‘Worthless, in fact; no use to Society at all.'
"‘Oh, I don't know,' said Atkins, who was nobody of importance, just a schoolmaster. ‘I am not so sure: it depends on what you mean by use .'
"‘No practical or economic use,' said Tompkins. . . .
. . .
"‘It is proving very useful indeed,' said the Second Voice. ‘As a holiday, and a refreshment. It is splendid for convalescence; and not only for that, for many it is the best introduction to the Mountains. It works wonders in some cases. I am sending more and more there. They seldom have to come back.'"