It can get quite complicated and in depth when you get into all the details of body chemistry, but basically there are cells in your body that adjust their individual productions on the 24 hour circadian rhythm with some specialized brain cells acting as the "master clock". This regulation keeps your body working and resting when it needs it. One of the most important aspects of the circadian rhythm is your sleep cycle and how much sleep you need.
The circadian rhythm is roughly 24 hours, but it varies by the individual. Circadian rhythms are generated by the body, but external stimuli can affect them. Light is one of the biggest cues for the circadian rhythm. Left on your own you might want to sleep an extra hour, but let the sun shine in and your circadian rhythm can be "reset" to make you wake up. Those with short circadian rhythms are often none as "morning" people because they are wide and awaken when the sun comes up. While those with longer circadian rhythms tend to be groggy.
Messing up your circadian rhythm can have serious negative impacts. Most often seen in over seas travel, if you disrupt you circadian rhythm in the short term you can experience jet lag, fatigue, disorientation and insomnia. If you disrupt your circadian rhythm chronically or for long periods of time you can lead to sleep disorders, bipolar disorder and even increase your risk for cardiovascular disease and cancer.