Quest to Erebor.
Gandalf invites Bilbo on an adventure. Gandalf wandered for many years amongst the Free People of Middle-earth, but spent most of that time amongst the Elves, where he learned much and taught much. He also continued to gather such information about Sauron and his ilk as he could, and to that end, he began to suspect that the Necromancer of Dol Guldur was in fact Sauron taking shape once again. He entered Dol Guldur, but Sauron, still greatly weakened, fled from him and for a short time, the evil of Mirkwood was greatly reduced. However, Sauron quickly returned to Dol Guldur, and by 2850 of the Third Age, had rebuilt his forces there. In that year, Gandalf again entered the fortress and encountered Thráin II, father of Thorin Oakenshield, who was dying after having been horribly tormented. Before his death, the old dwarf king entrusted Gandalf with a map and key to the Lonely Mountain. In the year 2941, Gandalf became troubled by his knowledge of Saurons resurgent strength. He knew that Sauron was already plotting war from Dol Guldur, and that as soon as he felt strong enough, he would attack Rivendell. Unfortunately, the only power left besides Rivendell to resist an attempt from Mirkwood to regain the lands of Angmar was the dwarves of the Iron Hills. Even worse, Gandalf knew that Smaug to Golden resided still in the Lonely Mountain, and that Sauron could and would use the dragon to devastating effect once he became strong enough to influence Smaug. However, Saruman seemed reluctant to engage Saurons forces, though none of the White Council realized that he was already a traitor. One night, while pondering the problem of the Free Peoples weakness in the North, Gandalf had a chance encounter in Bree with the dwarf Thorin II Oakenshield, who was also searching, without direction or much hope, for a way to reclaim the Kingdom Under the Mountain. Gandalf and Thorin then concocted a plan (more Gandalfs than Thorins) to potentially draw the dragon out of the mountain and reclaim the kingdom. To that end, Gandalf visited Bilbo Baggins, a Hobbit of the Shire, to convince him to go with Thorin and Company to Erebor and aid them.
Arrival in Middle-earth. When he arrived to Middle-earth, he received Narya, the ring of fire, from Círdan the Shipwright. Olórin, renamed Gandalf , spent many centuries walking among the elves as a stranger, learning from them and teaching them. He later revealed himself as one of the Istari, and eventually became known as the wisest of and most powerful of that order. He joined the White Council, which was formed to investigate a dark power in Dol Guldur, of which Galadriel wanted him to become the leader, yet Saruman came to lead the Council instead of him. Although Saruman was initially more powerful and more knowledgeable about many matters regarding Sauron and the Rings of Power, and was head of the White Council before the War of the Ring, he later grew jealous and afraid of Gandalf,  which was the reason of his betrayal.