I think I can remember a thread about this, but it is a while ago...Anyway, yes Gandalf did end up dying. Atleast, his physical body died, but his Maia self (Olorin) didn't. So, he was bidden to go back until his task was finished. Uniting the free peoples together and defeating Sauron.
Welcome to the downs
Athelas.