It was Loki who moved Odin out of Asgard. He was clever enough that no Asgardian but him knew. Even Thor learned the fact from Surtur.
How did Surtur learn that Odin was not on Asgard?
Science Fiction & Fantasy Stack Exchange is a question and answer site for science fiction and fantasy enthusiasts. It only takes a minute to sign up.Sign up to join this community
A few reasons come to mind and it was probably somewhat of a combination of all of them but we never get an explicit answer to this.
Surtur cannot die until he fulfils his destiny of Ragnarok and destroying Asgard. It seems likely that since this was his ultimate destiny he would have been waiting for his chance to do this, as he seemed keen to get on with it. As Odin "killed" Surtur a good while back it seems even more likely he would have been monitoring Asgard for a lack of Odin's presence.
Thor: Surtur. Son of a bitch...you're still alive! I thought my father killed you, like, half a million years ago.
Surtur: I cannot die. Not until I fulfil my destiny and lay waste to your home.
He may have even been doing this through monitoring of the Odinforce. Considering he's such a powerful being it seems likely he would have been able to sense the presence of the Odinforce.
The Nine Realms were in chaos and Asgard itself was not responding as it usually does. Thor was out on his own and had been "captured" by Surtur. Putting both events together it seems most likely Odin was not on Asgard because otherwise it would have responded to keep the peace as it always has done.
Thor: Possibly... but then I decide to go out there and investigate. And what do I find, but the Nine Realms completely in chaos. Enemies of Asgard assembling, plotting our demise, all while you, Odin, the protector of those Nine Realms, are sitting here in your bathrobe, eating grapes.
Thor himself kept having a premonition dream of Surtur and Ragnarok. If he was having that dream it's very possible Surtur was having it too. Surtur having it would mean he would know Ragnarok was close and combined with the above facts he probably worked out Odin wasn't present anymore. As Odin was the one to defeat him last time he would probably assume that for Ragnarok to be successful this time Odin would not need to be present. Therefore, for Ragnarok to be near it would seem likely that Odin would not be able to defend Asgard anymore.
Thor: You know, it's funny you should mention that because I've been having these terrible dreams of late. Asgard up in flames, falling to ruins, and you Surtur are at the center of all of them.
Surtur: Then you have seen Ragnarok, the fall of Asgard. The great prophecy--
"Odin": So it's back to Midgard for you, is it?
Thor: Nope. I've been having this reocurring dream lately. Every night I see Asgard fall into ruins...
I assume Surtur was being held at bay by Odin himself, and Surtur realized Odin wasn’t keeping him at bay anymore if he was alive again (although still lacking eternal flame\full power). Then he probably looked around the Realms, saw them in chaos, with no Odinforce energy emulating from Asgard, or even military action from Asgard. He put it all together from these facts.
I’m sure near the end of his life, Odin used all his energy keeping Hela at bay, and couldn’t hold Surtur’s essence back any longer, and he re-embodied his skull.