The story of The Hobbit, while superficially an elementary prequel to the epic Lord of the Rings, is also a story about growth and transformation. When we first meet Bilbo Baggins the hobbit and the dwarves, we are struck by their childlike qualities. The dwarves, despite the grave nature of their objective, to regain the crown and dwarven kingdom for Thorin Oakenshield, sing songs, drink, and laugh about the great adventure they are about to have. Bilbo finds within himself the childlike stirrings of a want of adventure, and although reluctantly, he agrees to accompany the party. However, while the party traveled together, they got into scrapes.
Increasingly, the dwarves and Bilbo came to rely on Gandalf to bail them out every time they were in a precarious situation. When Gandalf leaves, he removes the safety net the hobbit and dwarves have, and they are left to get out of their own scrapes. Ostensibly, Gandalf has left to join with Saruman to deal with the situation in the corner of the Mirkwood forest concerning the necromancer, but Gandalf left the dwarves and Bilbo because he wanted to force Bilbo into a situation wherein he would have to think of a way out.
The foolishness of the dwarves provides the perfect situation for Bilbo to grow into his abilities. When they are captured by the woodland elves, Bilbo must come to the rescue, using daring, courage, and wits he never realized he had. Similarly, in the incident with the spiders, Bilbo realizes a boldness and insolence he though nonexistent in the hobbit race. For the first time in his life, he goes on attack, and finds himself in a position of power. He, the smallest of the bunch, proves himself ablest, strongest, and smartest. Gandalf comes back and finds that Bilbo has actually become a leader, although not by choice. The dwarves forced him into several difficult situations through their foolish actions, and Bilbo steps up. Gandalf can congratulate him on his actions because he has begun to fulfill his potential. The dwarves, though much slower to realize their potential, grow as well, and by the end of the story have developed their own abilities.
The clear hero of the story, however, is Bilbo, who has found within himself a warrior and strength of character he never thought existed. Because of the dwarves’ constant lamentations for him, Gandalf remains a presence in the story for some time. Only as Bilbo begins to take action and solve problems does he come to the forefront, and the reader begins to forget that Gandalf is really not there. Just when Gandalf is fading away, and Bilbo is truly coming into his own, Gandalf returns, and this time, the hobbit and the dwarves can work alongside him, rather than waiting for him to essentially pull their fat out of the fire, as he literally did with the trolls in the beginning.