The Silmarillion is a collection of tales and histories that flesh out Middle Earth quite a bit.
The (wizards) Istari were Maiar -however when they came to ME their powers were diminished as their purpose wasn't to fight Sauron but to inspire others in the conflict against him
When it was perceived that the Istari did not die, but remained the same, only slightly aged, they were thought to be of Elven kind, but this was not so. The wizards were, in actuality, supernatural beings, Maiar, who had chosen or been chosen to take on human (incarnate) form. The Maiar in Tolkien?s pantheon equates roughly to an angel or archangel. They were sent by the Valar (highest order of spiritual beings) as emissaries from the Uttermost West across the Sea from the immortal land known as Aman. As emissaries, they had the task of aiding the struggles of the free peoples against the growing might of Sauron, the Dark Lord who was an evil Maia.
However, the Istari were given some orders to follow. They were not to face or confront Sauron directly, power to power, but inspire the free peoples to great deeds. They were not to dominate the free wills of the free peoples -- a principle reason for their mission was to prevent Sauron from dominating others. They were forbidden from revealing themselves in power or majesty. These rules were set down by the Authority, the omnipresence of Tolkien?s world. It was He who ordained the Rules. By being incarnate, it limited or "cloaked" the powers of the Maia, and intentionally so because they were to organize the resistance and inspire the peoples of Middle Earth to help themselves
The Istari were far older than they appear. They first appeared in Middle Earth around the 1000th year of the Third Age. Gandalf, one of the Istari, finally left Middle Earth after the War of the Ring, in the year 3021 of the Third Age. Only Cirdan the Shipwright, saw them arrive in Middle Earth. When Gandalf arrived, Cirdan perceived that he was the mightiest of heart and gave him the Red Ring of Fire, Narya.
"For great labors and perils lie before you, and lest your task prove too great and wearisome, take this Ring for aid and comfort. It was entrusted to me only to keep secret, and here upon the West-shores it is idle; but I deem that in days ere long to come it should be in nobler hands than mine, that may wield it for the kindling of all hearts to courage." (Tolkien: Unfinished Tales, P.504)
Who would go? For they must be mighty, peers of Sauron, but must forgo might, and clothe themselves in flesh so as to treat on equality and win the trust of Elves and Men. But this would imperil them, dimming their wisdom and knowledge, and confusing them with fears, cares, and weariness coming from the flesh." (Tolkien: Unfinished Tales, P 508)
Tolkien?s philosophy on working physical effects in the "real world" of Middle Earth required that a spirit or will actually be a physical entity. Gandalf was a Maia, as all the Istari were, an angelic being "clothed" in mortal flesh and therefore subject to physical harm; such as hunger, weariness, and even injury and death. This is why Gandalf fighting a balrog is intriguing. A balrog was an evil demon of fire that was in the service of The Dark Lord. Thus, with Gandalf subject to the flesh, his facing the balrog is a real and deadly danger. At this point in the story, Gandalf realizes that the Quest of the Ring was in danger an he sacrificed himself to ensure the escape of his friends. He fell off the bridge, locked in combat with the balrog and both eventually perish
In order to understand why Gandalf did not just blast the balrog, we must remember the Rule prohibiting the Istari from exercising power. By sacrificing his life, Gandalf was conforming to the Rules. He was handing over to the Authority who ordained the Rules, giving up personal gain for the insured safety of his friends. The Authority accepted the sacrifice and Gandalf was returned.
And when, at the end of The Lord of the Rings Sauron was finally vanquished through the courageous effort of the hobbit, Frodo, the Istari were done their mission. It was only Gandalf who remained faithful to the mission, and it is he, who was allowed back to Valinor
"Well, here at last, dear friends, on the shores of the Sea comes the end of our fellowship in Middle Earth. Go in peace! I will not say: Do not weep; for not all tears are an evil."(Tolkien: The Return of the King, P377)