Gandalf arrived in Middle Earth as Olorin, one of at least five Maia sent by the Valar during the Third Age to help resist Sauron as the Elves were departing into the West in increasing numbers and in the wake of the fall of Numenor.
As a Maia, Olorin was in the same class of beings that included Saruman, Radaghast, and the Balrogs of Morgoth. If we think of the Valar as essentially demi-gods, then the Maiar are similar to angels and demons. (Though angels don't show up in Middle Earth named as such, Gandalf does refer to the Balrog of Moria as a "demon of the ancient world" in the Fellowship of the Ring.)
When Olorin arrived at the Grey Havens, the westernmost outpost of the Elves in Middle Earth, he met Cirdan the Shipwright, an ancient Noldor Elf who was in charge of building the swanlike vessels that took the Elves into the Uttermost West. Since the breaking of the world, these vessels needed to be able to travel through the emptiness of space that now separated Middle Earth from the the Undying Lands - once accessible by water, they were now sundered from the world (essentially, an Upper-Earth or Asgard in the Northern European scheme that Tolkien adopted for the structure of the world - where Middle Earth ~ Midgard).
Cirdan at the time was the bearer of Narya, the Elven Ring of Fire, one of the "three Rings for Elven Kings under sky". When he met Olorin, Cirdan gave him Narya, to wear in secret, seeing that Olorin would be called upon to ignite the courage and spirit of many in resistance to Sauron. It wasn't revealed that Olorin/Gandalf had the Ring of Fire until the end of the Return of the King and the destruction of the One Ring.
Olorin, obviously, wasn't the name that this Maia went by for the most part - he allowed those he met to give him names in their own languages that usually translated as something like "wanderer" or "grey pilgrim". He was known as Gandalf Greyhame in Westron, the language of humans and Hobbits, and as Mithrandir in Sindarin, the language of the Grey Elves; as Tharkun to the Dwarves and Incanus in the South - and so on. Wormtongue named him Lathspell, but that one didn't stick.
If you're familliar with the stories of the Hobbit and the Lord of the Rings, I don't have to rehash all that Gandalf accomplished. It is clear that the defeat of Sauron and the destruction of the One Ring is primarily the work of Gandalf.
But long before Gandalf ever came to Middle-Earth, he was living among the Valar, and studying under a particular one named Nienna. Nienna is the Vala associated with grief and mourning, as well as the color grey (the reason Gandalf was "the Grey"). She took part in the creation of the Two Trees of Valinor, which first joined the stars in lighting the world, and when Ungoliant poisoned the trees and destroyed them, her tears were able to coax the final fruit from them that became the Sun and the Moon.
What Nienna teaches is pity and endurance, and it can be said that it is pity and endurance which enabled the defeat of Sauron. Pity which stayed Bilbo's hand when he could have killed Gollum when they parted ways, pity that later stayed Frodo's hand, enabling Gollum to fulfill his destiny in the destruction of the Ring. And endurance, even beyond hope, is at the center of the story of the Lord of the Rings.
It is very, very interesting to me that the greatest hero, the moral compass, and perhaps the most powerful archetypal character of Tolkien's most popular stories is Gandalf, and that Gandalf is associated with grief of all things. Gandalf is also the one who is resurrected as the White - a rather Christlike event. Behind almost everything accomplished in the Third Age, there is Gandalf. And he was taught by the goddess of tears. Not authority. Not power. Not craft, or beauty, or dreams, or fate. The goddess who weeps for the world, and whose tears can heal the most terrible injury.
In a religion where we worship a God who was killed, I think we have a lot of thinking to do about grief. There is the grief of God, and there is the grief that we have for God. What is Holy Week if not a week of grief? What are Good Friday services if not services of grieving?
Do we dare face our grief? I think if we do, it can be powerful. I think we have no idea how powerful our grief can be. When faced with pain, it is common to become afraid, or to become angry - to seek vengeance and restitution. These things, I think, are in some ways attempts to escape our raw, naked grief. Can grief heal? We think in terms of healing grief, but is it the grief itself which heals?
I think Gandalf, and Tolkien, would say yes. And that's one of the most powerful things, for me, about the whole mythopoetic enterprise that Tolkien underwent. I think he is saying that grief is central to salvation from evil, central to healing and redemption. For me, this is worth a lot of thought.