I think I read something about some birds being able to sleep with only one hemisphere of their brain at a time, similar to dolphins. The common swift often spends months at a time without touching ground.
And lots of birds perform marvelous feats of long-range navigation, storks, for example, travel thousands of kilometers each year to return to their nest for breeding.
I would suppose that they don’t “know” they just feel compelled.
There are dragon flies that migrate from India to Africa. It takes three generations to complete the round trip. So how do they know? It must be just a feeling.
I guess that a long time ago when India and Aftrica were adjacent parts of Gondwana land, the migration must have been quite short. But as the continents drifted apart the dragoon flies had to adapt to the longer route.