I've be pondering this question for a few days now and cannot decide either way.
Gandalf knew nothing of the
Balrog in
Moria, and therefore cannot have foreseen a confrontation with so great a foe. (Although I'm sure he had some intimations of the Power of the Creature formerly known as
Durin's Bane) And thinking about it, apart from a lucky swipe on the part of the Balrog... Gandalf would have been home free...
As to whether or not he knew he needed to return to
Valinor to be reappointed in his power (or indeed whether or not he knew he could return to
Middle Earth at all once his physical form was slain) I'm not still in two minds. Yet the battle with the Balrog on the
Bridge of Khazad-dûm was not the first time Gandalf had been ready to lay down his life. Years before in a minor skirmish in the eastern foot-hills of the
Misty Mountains...
from 'Out of the Frying-Pan into the Fire'
'Then Gandalf climbed to the top of his tree. The sudden splendour flashed from his wand like lightening, as he got ready to spring down from on high right among the spears of the
goblins. That would have been the end of him, though he would probably have killed many of them as he came hurtling down like a thunderbolt. But he never leapt.'
Given that this quote is pre-LoTR (and quite possibly before Gandalf had evolved into a Emissary of the West) not much can be drawn from it. Yet he
does seems rather nonchalant about his life - considering he is just about to embark on a journey to flush
Sauron out of
Mirkwood - is there a possibility that all the
Istari thought they could be returned to ME if their physical forms were slain?
After
Saruman's physical form is destroyed, his spirit can be seen briefly glancing westwards as if waiting for something...
from 'The Scouring of the Shire'
'To the dismay of those that stood by, about the body of Saruman a grey mist gathered, and rising slowly to a great height like smoke from a fire, as a pale shrouded figure it loomed over the Hill. For a moment it wavered, looking to the West; but out of the West came a cold wind, and it bent away, and with a sigh dissolved into nothing.'
Umm... I'm just babbling now...
