Tired of ads?
Join today and never see them again.
Gandalf is the one who literally plucks Bilbo from his cozy little home and tosses him into a load of adventure. Clearly, Gandalf has some notion of what Bilbo's adventures are going to mean to the hobbit. As Gandalf tells the doubtful dwarves, "If I say he is a Burglar, a Burglar he is, or will be when the time comes" (1.100). Sure, Gandalf can't see the future, but he can see a lot more than all the other characters in the novel, and he seems to know everything that's in Bilbo before Bilbo knows it himself.
Gandalf is also more powerful than everyone else in the book: he's able to help the dwarves escape from the goblins with his fancy magic powers, and he even stops the opposing human, elf, and dwarf armies with a single shout and the news that the goblins and Wargs are coming. We wish we could stop whole armies with one cry of "Halt!" (17.41).
Gandalf is the guide that keeps Bilbo and the dwarves (mostly) safe through their first adventures with the trolls and the goblins. But, at a certain point, the dwarves have to learn to trust Bilbo on his own merit. And this will never happen unless they're in true danger and need Bilbo's help to get them out of it. Thus, Gandalf is actually too powerful a character to accompany the group on their whole quest – he would keep them too safe to learn anything from one another. So, conveniently, Gandalf is called away on "some pressing business away south" (7.136). With the dwarves' experiences in Mirkwood and outside the Lonely Mountain in Gandalf's absence, they start to realize that, "Now [Bilbo] had become the real leader in their adventure" (12.41).
Gandalf's role in The Hobbit is relatively straightforward. He's a guide and a protector. We don't get much of a sense of him as a three-dimensional person (except that he's on the side of Good and that he's a bit touchy). But Tolkien does leave room for us to be curious about Gandalf and what he's there for:
Gandalf! If you had heard only a quarter of what I have heard about him, and I have only heard a very little of all there is to hear, you would be prepared for any sort of remarkable tale. Tales and adventures sprouted up all over the place wherever he went, in the most extraordinary fashion. (1.6)
Gandalf (and possibly Elrond, though he doesn't come into The Hobbit much) is thus part of Tolkien's larger folklore: he comes in and out of "tales and adventures [...] in the most extraordinary fashion." There's something supernatural and suggestive about Gandalf that makes us think, wow, Bilbo's adventures are only one of thousands Gandalf has engineered. One day, if we see a guy in a tall, pointy hat and a grey cloak with a walking stick/wizard's staff, we're going to intensely hope that he's here to take us on "any sort of remarkable adventure."