Caffeine works by changing the chemistry of the brain. It blocks the action of a natural brain chemical that is associated with sleep. Here is how it works.
If you read the HowStuffWorks article How Sleep Works, you learned that the chemical adenosine binds to adenosine receptors in the brain. The binding of adenosine causes drowsiness by slowing down nerve cell activity. In the brain, adenosine binding also causes blood vessels to dilate (presumably to let more oxygen in during sleep).
Adenosine is produced by your daily activity. For example, the article How Exercise Works discusses how muscles produce adenosine as one of the byproducts of exercise.
To a nerve cell, caffeine looks like adenosine. Caffeine, therefore, binds to the adenosine receptors. However, it doesn't slow down the cell's activity as adenosine would. The cells cannot sense adenosine anymore because caffeine is taking up all the receptors adenosine binds to. So instead of slowing down because of the adenosine level, the cells speed up. You can see that 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.
With caffeine blocking the adenosine, you have increased neuron firing in the brain. The pituitary gland sees all of the 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, of course, the "fight or flight" hormone and it has a number of effects on your body:
- Your pupils dilate
- Your breathing tubes open up (this is why people suffering from severe asthma attacks are sometimes injected with epinephrine)
- Your heart beats faster
- Blood vessels on the surface constrict to slow blood flow from cuts and also to increase blood flow to muscles; blood pressure rises
- Blood flow to the stomach slows
- The liver releases sugar into the bloodstream for extra energy
- Muscles tighten up ready for action
This explains why, after consuming a big cup of coffee, your hands get cold, your muscles tense up, you feel excited and you can feel your heart beat increasing.