It’s such a complicated question that I don’t think scientists who study this even have proper idea of why. I suppose if you were to try and investigate it you would have to look at all the factors that could cause a whale to be beached. You’d have to look at all the information found out when it’s happened in the past and try to spot some patterns in location, whale size/age maybe? local conditions, if there were big ships around, etc. Science is all about making hypothesis and then testing them to see if they are true or not. Eventually, hopefully, you’ll find the right answer!