During Thor: Ragnarok, there are a few instances where Thor is clearly on the ropes in a fight. On the occasions this happens, Thor appears to see Odin as he was in Norway at the beginning of the movie and even holds a conversation with him in one instance. However, Odin has "moved on" by this time.
It seems clear that these experiences are similar to various flashback-type scenes in the way that they take almost no time at all in the movie's actual timeline despite Thor appearing to experience them for several seconds or even a minute or two. Are these experiences with Odin just a mental imagination of Thor's and he's essentially mentally hyping himself back up? If not, and these are "real" conversations with "real" Odin, then how are these occurring?