I came upon this interesting article which talks about the ancestry of whales being land-breeders. This is to say that whales may have once came up onto the land as a part of their breeding cycle (such as sea turtles do, for instance).
You can read the article here.
It got me to wondering if this might go some distance towards explaining why whales sometimes beach themselves. The usual explanation I have heard is “humans suck”. Essentially, we humans make so much noise in the oceans (and we certainly do) that the whales get confused and run aground. This has never really satisfied me.
So, perhaps the whales are responding to a residual instinctual call to visit the land. I suppose this could be tested against whale beachings as they relate to cyclical events in whale breeding seasons.
The New Scientist article to which I link above does talk about whales returning to land to give birth, but I’m really just speculating so don’t throw a shoe at me.