Gandalf's Omniscient Understanding
Gandalf's fascination with Hobbits paid off in The Lord of the Rings, but did he know from the beginning how useful they would be in the fight against Sauron? The answer to this question is somewhat complicated. As the guardian character archetype, Gandalf often seemed to have an omniscient understanding of events. It was because of the wizard that Bilbo ended up with the One Ring and, therefore, that Frodo inherited and carried it to Mordor. Still, it's cruel to think that Gandalf would have made this happen on purpose or that his interest and love for Hobbits came solely from his belief that they could benefit his quest.
Ian McKellen as Gandalf in The Lord of the Rings: The Fellowship of the Ring.
No other being in Middle-earth could have handled Sauron's One Ring the way Hobbits could. The powerful weapon prayed on a person's ambitions, distorting them until nothing was left in their heart but a longing for power and control. Humans were particularly vulnerable to such an attack, and Elves weren't far behind them. However, because Hobbits generally value community and a contented, simple way of living rather than power and authority, there was far less for the One Ring to manipulate. This is why Bilbo, Frodo, and even Gollum were able to keep the Ring for so long—but Gandalf's interest in Hobbits went far beyond just this.
Gandalf greets Bilbo in The Hobbit
Gandalf often seemed to have an omniscient understanding of events. It was because of the wizard that Bilbo ended up with the One Ring and, therefore, that Frodo inherited and carried it to Mordor.
Gandalf talking to Bilbo in the hobbit An Unexpected Journey
Gandalf's Interest in Hobbits
In Tolkien's Unfinished Tales, a brief history of Gandalf's involvement with Hobbits is given in The Quest of Erebor. It's explained that the Gray Wizard came upon the Halflings a little less than 300 years before the events of The Lord of the Rings, and he quickly came to have 'a warm place in [his] heart for them.' This was during the Long Winter, which saw parts of Middle-earth (Eriador, Dunland, and Rohan) covered in snow and ice for five months. The dangerous conditions made it especially hard for the hole-dwelling Hobbits, and the Long Winter could easily have wiped them out. However, Gandalf found they were far heartier than one would have expected.
Gandalf smoking in Bilbo's house in The Hobbit An Unexpected Journey (1)
Gandalf noted in The Quest of Erebor that 'it was by their pity as much as by their tough uncomplaining courage that they survived,' and this led the wizard to love and respect them deeply. As he continued to study their people, he learned that they were uncomplicated in their desires, appreciating the finer things in life, such as caring for the earth, enjoying a bountiful harvest, and smoking pipeweed. Through them, Gandalf learned to enjoy the same things. He visited the Hobbits periodically over the centuries and gained a reputation for telling Hobbit children stories and lighting off fireworks. In all, it was a highly organic relationship, born of Gandalf's natural fascination with their way of life.
Bilbo and Frodo at Bilbo's birthday party in Lord of the Rings
Hobbits had become so private that most Men, Elves, and Dwarves didn't know they existed when Gandalf discovered them.
Frodo and Gandalf sitting on a bench in Lord of the Rings the Fellowship of the Ring
Gandalf's Valuable Relationship with Hobbits
When the time came in The Hobbit for Gandalf to help the Dwarves reclaim their home from Smaug and, therefore, ensure that Sauron didn't gain a powerful ally in the dragon, he thought Hobbits might be of great help. The Hobbits' goodness, heartiness, purity, and appreciation for the finer things in life led the wizard to study them endlessly, and he found they were perfectly equipped for sneaking around—yet, their nature made them trustworthy. Then, there was their courage and compassion. The right Hobbit would be brave enough to make it through and would feel for the Dwarves enough to want to help (after some time).
Gandalf smoking in Bilbo's house in The Hobbit An Unexpected Journey (1)
Ultimately, Gandalf chose Bilbo Baggins for the job. He hoped the Hobbit was the right choice and certainly thought that this mission would have an impact on the Istari wizard's mission to guide the beings of Middle-earth against Sauron. However, Gandalf had absolutely no idea that Bilbo would find the One Ring while on this journey. It's heavily implied that he wasn't as surprised about this detail as he might have been since the Gray Wizard understood that there were powers at work beyond himself. In The Quest of Erebor, Gandalf said, 'I dare say he was “chosen” and I was only chosen to choose him; but I picked out Bilbo.'
Lord of the Rings Gandalf Rings of Power The Stranger
Bilbo was predestined (likely by the god of Middle-earth, Eru Ilúvatar) to find the One Ring, pass it on to Frodo, and, therefore, begin the end of Sauron's evil reign. Gandalf was simply a tool in this design. The old wizard wouldn't have chosen such a fate for Hobbits—he didn't develop a friendship with them, intending to use them as pawns in the fight against evil. However, this isn't to say that his interest in them was a coincidence, either.