Your Internal Clock
Why you wake up moments before your alarm
Your body has an internal timekeeper that runs on roughly a 24-hour cycle and tracks not just sleep and wake, but fine-grained intervals throughout the day. At the center is the suprachiasmatic nucleus, a small cluster of neurons in the hypothalamus that coordinates circadian rhythms across every organ. Light is its most powerful signal, which is why windowless rooms or travel across time zones throws the whole system off.
In real life...
Keep a consistent sleep and wake schedule. Even on weekends, to keep your internal clock well-calibrated. If you need to shift your schedule, expose yourself to bright light at your new target wake time, since light is the most powerful signal your circadian clock uses to reset itself.