In The Two Towers, what does Gandalf think about how Frodo goes to Mordor? I mean, he knew that obviously Frodo didn't know the road to the Mordor, so how can he say "Each day Frodo brings it closer to the fires of Mount Doom"?
Gandalf hopes in the providence of Eru Ilúvatar. He doesn't know specifically how Frodo will get to Mordor (although Frodo might know the general direction by studying maps in Rivendell), but hopes that Eru -- who just brought Gandalf back to life to finish his mission (which is to defeat Sauron) -- will guide Frodo there through some means.
We can see that in these quotes:
"Behind that there was something else at work, beyond any design of the Ring-maker. I can put it no plainer than by saying that Bilbo was meant to find the Ring, and not by its maker. In which case you also were meant to have it. And that maybe an encouraging thought."
"My heart tells me that [Gollum] has some part to play yet, for good or ill."
Gandalf tells Pippin that he doesn't have much hope that the plan will succeed. But since no one could think of a better plan, he does everything he can to help it succeed. If Frodo had already been caught at the point and the plan definitely failed, Gandalf would have probably said the same thing.
I believe it is allegorical to the Biblical concept of free will. Even though Tolkien stated numerous times that LOTR was NOT allegory, in later life he acknowledged the religious nature of the work (see link and quote below). Gandolf (a God-figure, obviously) knows that he has to allow Frodo to complete the task through the choices Frodo makes. Frodo is free to make choices, for good or bad, to complete his burden. Very Biblical.
http://www.catholiceducation.org/en/culture/art/20-ways-the-lord-of-the-rings-is-both-christian-and-catholic.html "J.R.R. Tolkien wrote, "The Lord of the Rings is of course a fundamentally religious and Catholic work; unconsciously so at first, but consciously in the revision.""