How are people able to wake themselves up after a pre-specified amount of time?
There is quite a lot of research on self-awakening (see this search on Google Scholar for self awakening). Hopefully someone else more familiar with this literature can add a more authoritative answer about the mechanisms of self-awakening. In the interem I briefly extract some relevant points from  Ikeda and Hashi (2012). The study does not directly address biological mechanisms. However, understanding the reliability of self-awakening and the correlates of the ability to self-awaken is presumably relevant to forming such an understanding.

First they summarise some existing research:


  Both the accuracy and success rate of self-awakening have been
  experimentally examined. More than half of the people who have the
  ability to self-awaken suc- cessfully awakened within 30 minutes of
  the predetermined time. For example, seven participants succeeded on
  nine of 14 days (64%) in a sleep laboratory, and 15 participants
  succeeded on 35 of 44 nights (80%) at their homes. Survey studies
  indicate that many people habitually self-awaken in daily life; for
  example, 52% of 269 adults (aged 21−84 years) and 10.3% of 643
  university students6 reported habitu- ally self-awakening. People who
  have a habit of self-awakening in the morning have regular sleep/wake
  schedules, tended to have a morningness chronotypology, awakened
  comfortably in the morning, and had less daytime dozing.


In their own study they found:


  The present study investigated self-awakening, both habitual and
  inconsistent, compared to awakening by external means in relation to
  sleep/wake schedules for five consecutive years in 362 students
  (starting at mean age 15.1 ± 0.3 years). Students who self-awakened
  consistently for five consecutive years (5% of all students) went to
  bed earlier than those who inconsistently self-awakened (mixed group,
  40%) or consistently used forced awakening by external means (56%).
  Awakening during sleep was more frequent and sleep was lighter in the
  consistently self-awakened group than in the mixed and consistently
  forced-awakened groups. However, daytime dozing was less frequent and
  comfort immediately after awakening was greater for the consistently
  self-awakened group than for the mixed and consistently
  forced-awakened groups.


Reference


Ikeda, H., &amp; Hayashi, M. (2012). Longitudinal study of self-awakening and sleep/wake habits in adolescents. Nature, 4, 103-109. PDF
Bell CR. Awakening from sleep at a pre-set time. Percept Mot Skills. 1980;50(2):503–508.
Lavie P, Oksenberg A, Zomer J. “It’s time, you must wake up now.” Percept Mot Skills. 1979;49(2):447–450.
MoorcroftWH,KayserKH,GriggsAJ.Subjectiveandobjectiveconfir- mation of the ability to self-awaken at a self-predetermined time without using external means. Sleep. 1997;20(1):40–45.
ZepelinH.REMsleepandthetimingofself-awakenings.BullPsychon Soc. 1986;24(4):254–256.
Zung WW, Wilson WP. Time estimation during sleep. Biol Psychiatry. 1971;3(2):159–164.
Matsuura N, Hayashi M, Hori T. Comparison of sleep/wake habits of university students with or without a habit of self-awakening. Psychiatry Clin Neurosci. 2002;56(3):223–224.