In the HowStuffWorks article How Sleep Works, the action of adenosine is discussed in detail. While it sounds like advanced science, it's really pretty simple.
As adenosine is created in the brain, it binds to adenosine receptors. The binding of adenosine causes drowsiness by slowing down nerve cell activity.
In the brain, adenosine binding also causes blood vessels to dilate, most likely to let more oxygen in during sleep.
To a nerve cell, caffeine looks like adenosine. Caffeine therefore binds to the adenosine receptor. However, it doesn't slow down the cell's activity like adenosine would.
As a result, the cell can no longer identify adenosine because caffeine is taking up all the receptors that adenosine would normally bind to. Instead of slowing down because of the adenosine's effect, the nerve cells speed up.
Caffeine also causes the brain's blood vessels to constrict, because it blocks adenosine's ability to open them up. This effect is why some headache medicines like Anacin contain caffeine -- if you have a vascular headache, the caffeine will close down the blood vessels and relieve it.
So, now you have increased neuron firing in the brain. The pituitary gland sees all of this activity and thinks some sort of emergency must be occurring, so it releases hormones that tell the adrenal glands to produce adrenaline (epinephrine).
Adrenaline is the "fight or flight" hormone, and it has a number of effects on your body: ................