Tolkien once described Gandalf as an angel incarnate; later, both he and other scholars have likened Gandalf to the Norse god Odin in his "Wanderer" guise.
Gandalf is a divine spirit clothed in a mortal form. In Middle-earth parlance, he's a creature known as a Maia (plural: Maiar). The Maiar are sort of like demigods, in that they serve a higher order of godlike beings, the Valar.
The wisest of the Maiar, Gandalf was created by Ilúvatar before the Music of the Ainur. At the beginning of Time, he was amongst the Ainur who entered into Eä. In his "youth" he was known as Olórin and lived in Lórien.
Gandalf is, in an incredibly simplified version, a lesser God. He takes the form of a man in Middle Earth because that's the role he is to assume there to be able to walk among mortals. Gandalf the Grey is one of five “wizards” sent to Middle Earth to combat evil, such as Sauron.
The figure of Gandalf is based on the Norse deity Odin in his incarnation as "The Wanderer", an old man with one eye, a long white beard, a wide brimmed hat, and a staff. Tolkien wrote in a 1946 letter that he thought of Gandalf as an "Odinic wanderer".
Odin is the wielder of Gungnir, the greatest of the Four Treasures. As a result, he possess great power. He also has knowledge of many things. Odin's advantage over other gods is his half-elf side, which allows him to continually grow in power, according of Lezard, Odin used to be a rather weak god.
Gandalf, like all the five wizards of Middle-earth, was a Maia, an angelic spirit of the same order as Sauron.
Eru is introduced in The Silmarillion as the supreme being of the universe, creator of all existence, including the world, Arda, and its central continent, Middle-earth. In Tolkien's invented Elvish language Quenya, Eru means "The One", or "He that is Alone" and Ilúvatar signifies "Allfather".
As one of the Maiar, Gandalf was not a mortal Man but an angelic being who had taken human form. As one of those spirits, Olórin was in service to the Creator (Eru Ilúvatar) and the Creator's 'Secret Fire'.
While Dumbledore is a powerful wizard, Gandalf's innate magical abilities and experience in leadership and diplomacy give him an edge in a battle between the two. While the outcome of a battle between the two would depend on the circumstances, Gandalf would win more often than not.
Like Galadriel, much of Gandalf's power, both as Gandalf the Grey and Gandalf the White, came from his extensive knowledge about almost everything; he spoke many languages, was attuned with the many cultures and species of Middle Earth, and could even accurately guess others' thoughts without having to actually read ...
However, in J.R.R. Tolkien's books, he does not have one representation of Jesus but rather three: Gandalf, Aragorn, and Samwise Gamgee (perhaps representative of the Holy Trinity, the concept of 'God in three persons'). Each of these characters symbolizes a different aspect of Jesus Christ.
Early in the first volume, The Fellowship of the Ring, the wizard Gandalf describes Saruman as "the chief of my order" and head of the White Council that forced Sauron from Mirkwood at the end of Tolkien's earlier book The Hobbit.
In the Fellowship of the Ring book, it took Gandalf 17 years to determine that Bilbo's Ring was, in fact, Sauron's One Ring. The Ring had been lost before Gandalf came to Middle-earth, and with Saruman's assurances that it had been lost at sea, it hadn't seemed possible that Bilbo could have come by it.
Saruman, jealous and afraid of Gandalf, set spies to watch all his movements; thus he discovered the existence of the Shire and noted Gandalf's interest in it, and started sending agents in Bree and the Southfarthing. As Lord of Isengard, Saruman began to bring trouble to Rohan by aiding its enemies.
So yes, he is immortal. However maia can be killed, since once their bodies are destroyed then they cannot be re-embodied. Gandalf was only brought back by the will of Eru, who is all-powerful. Once he returned to Valinor, it's certain that he re-assumed his Maia-form.
Gandalf's age is impossible to determine, but he's likely existed for at least 10,000 years, making him much older than Legolas.
As Gandalf the Grey, his weaknesses are no more than that of other Istari. Bound in an old man's body, he is unable to use his powers to the fullest extent. He ages, albeit slowly, and is affected by physical wounds and poisons.
Sauron: The Big Boss At The End Of The Game
Do you realize that The Lord of the Rings gets its title, not from its protagonist, but from its main villain? From his dominance in the Second Age, all the way to the terror that he wielded during the trilogy, Sauron was peerless in his streak of evil.
Getting back to the puzzle, however, the solution is simply that the name "Gandalf" was tied to a prior life. After he was sent back, Gandalf would have recognized his friends, because they were all part of the job he was sent back to do.
The ages of his characters differ wildly; Gollum is almost 600 years old, while Elrond, the elf, is several thousand years old, and Gandalf the Grey – and later the White – is immortal (for display reasons, both are thus not mentioned here).
During the end of Lord of the Rings, it's likely that Sauron was well-aware of Frodo's presence in Mordor. So why didn't he do anything about it? When Frodo finally arrived at the lands of Mordor, Sauron likely knew about his presence.