it blocks the Enzyme phosphodiesterase from removing the secondary messenger
cAMP, so the excitory signals from adrenaline etc. persist much longer (recall
that viagra works in a similar
manner)
and
it blocks Adenosine receptors in the brain. Adenosine builds up in the course
of a day, and when levels are high enough, the adenosine binds to receptors
that cause nerves to release inhibitory signals that lead to drowsyness and
sleep. Adenosine also causes a dilation of blood vessels to the brain , presumably
to provide more oxygen and nutrients to cells needing to be replenished.
So, the effect of caffeine is to disable braking systems in the brain (adenosine)
and the body (phosphodiesterase) resulting in a prolonged sense of wakefulness
and alertness. Among the physiological effects is a constriction of blood
vessels which can relieve the pressure of migraines
and
other headaches. Caffeine can significantly increase the effectiveness
of analgesics such as aspirin and is often included with them.
However there can be a rebound effect when the caffeine has worn off (been
metabolised) and you can end up with a worse headache. Headaches are also
a common sympton of caffeine withdrawal for the same reason.