First: this does not happen so far for everyone!
Second: This requires certain prerequisites:
you should have a good sense of timing. Subconscious. This does not mean that you are necessarily able to say at any moment what time it is. The subconscious mind knows. Whether it tells the exact time to consciousness is not a fact.
Here is a fork. On the one hand, such a wake-up can occur with people with sensitive sleep and not very healthy nerves. But on the other hand, it can happen to people who are extremely disciplined, regardless of their state of health.
Third: the above prerequisites are prerequisites. But the conditions are not sufficient. In other words, the presence of these prerequisites does not yet guarantee an accurate automatic awakening.
Of course, not everyone has this, many with an alarm clock "under their ear" can oversleep ... I think so: For the most part, this is a habit developed over the years! In some it turns out intuitively, Sometimes by accident)
This is not the case for everyone. Some people have some sort of wake-up time programming. You have thought about the right time, the subconscious has fixed it, and by that moment you will wake up. A striking example from the film is Stirlitz, who could wake up without an alarm clock after 15 minutes of sleep.
People without such "abilities" can also "train" and wake up without an alarm clock. To do this, it is enough to get up at the same time for 2 weeks.