In The Two Towers, when Gandalf meets Aragorn, Legolas and Gimli for the first time since the Balrog encounter, he briefly gives some details of the encounter which to me are (perhaps intentionally) vague. In particular though when Gwaihir finds him, Gandalf tells of this exchange of words
Gandalf: '"Do not let me fall!" I gasped, for I felt life in me again. "Bear me to Lothlórien!"'
Gwaihir: "That indeed is the command of the Lady Galadriel who sent me to look for you."
The text implies that Gandalf had indeed died but had been returned to Middle-earth, possibly by the Valar (this at least is how I read it but I am happy to be corrected). My question is how does Galadriel know of this to send Gwaihir looking for him? Does she suspect that he has survived the encounter or does she somehow know that he will be returned? Is it to do with the fact that they both bear one of the three rings, or something to do with Galadriel's mirror or something else entirely? Is any explanation for this given for this outside of the LOTR trilogy?