Anyone who has lived for any time in the world recognizes that the world changes in cyclical patterns: day and night, the seasons, and tides. Many animal species have a sort of internal clock, called a biological clock, which predicts cyclical environmental change and prepares the animal to deal with it. Biological clocks can be set by exogenous (external) stimuli, or by endogenous (internal) rhythms. Exogenous stimuli are called Zeitgebers, which means "time giver" in German, and include light, temperature, and length of day. Endogenous clocks are responses to an internal rhythm that is pre- programmed to correspond with the environmental temporal pattern.
Circadian (literally "about a day") rhythms are endogenous animal clocks that operate on a daily time schedule. Most circadian rhythms are actually slightly shorter than 24 hours, some are longer, and a few are exactly 24 hours. Jet lag provides a common example of circadian rhythm. When a person experiences jet lag, their biological clock is alerting them that it has reached the time to sleep during their twenty-four hour cycle, but because they have traveled so far the internal clock mechanism does not coincide with the actual time of day.
In general, circadian rhythms are endogenous, acting independently of external stimuli. Most introductory tests (such as AP Biology) will probably treat circadian rhythms as such. However, some daily cycles are maintained by a combination of an endogenous clock and external stimuli such as sunlight. In Drosophila (fruit flies) rhythms for determining emergence from the pupal stage, which must take place at a specific time of day, are determined by two gene products, Per (period) and Tim (timeless). Per is involved in a self-regulatory feedback loop which causes cyclic changes in its concentration over the course of the day. Tim is also self-regulatory, but it is also light sensitive, so changes in the normal light-dark cycle will be reflected in Tim concentrations. These two proteins constitute a daily clock that is both endogenously and exogenously regulated.
The dependence of some internal clocks on the presence or absence of light presents an interesting problem: how do cells deep within the body know if it is light or dark out? In vertebrates, this information is routed through an organ called the pineal gland. In some fish, birds, and reptiles this organ has photoreceptors and can sense light directly. In mammals the pineal gland has no light sensing ability of its own, but rather receives light information from the eye through the suprachiasmatic nucleus (SCN), which connects to the pineal gland through the sympathetic nervous system. The pineal gland secretes proteins such as melatonin, which send the light signal to the rest of the body.
While behaviors such as pupal emergence, sleep, and activity must be regulated on a daily basis, other behaviors need to be regulated over longer periods of time. For example, mating in marine organisms is often linked to stages of the tides. In the paolo worm, mating occurs in the neap tides during the last quarter moon of October in November. These worms are very vulnerable during mating, so by synchronizing their mating behavior to an exogenous factor such as tides, they can outnumber predators and increase the probability that some mating will be successful. This circannual mating rhythm provides the paolo worm with increased chances of survival: it makes both individuals and the species more fit. In other words, the rhythm is selected for by natural selection, and thereby evolves into a common species trait.