Why does caffeine affect cognitive performance?
Caffeine increases circulating epinepherine levels[a][1]. This stimulates lipolysis[b][2].
Lipolysis "involves the hydrolysis of triglycerides into free fatty acids followed by further degradation into acetyl units by beta oxidation"[3]. This produces ketone bodies, which can be burned for energy by the brain.
According to Dr. Emily Deans[4], "it is actually less efficient to make ATP from glucose than it is to make ATP from ketone bodies!" In fact, "ketosis actually increases the ATP/ADP ratio in the brain"[5].
Because ketones can be burned in most regions of the brain, more energy is available to the brain when ketone levels are elevated[4][5][6].
TL;DR: Regular consumption of caffeine can cause ketosis, and the brain is metabolically more efficient in ketosis.
—
What are the effects of caffeine on cognitive performance, and to what extent do these effects manifest themselves?
Caffeine appears to improve working memory as tested by performance on n-back tasks[11].
Caffeine appears to improve cognitive performance and mood, and increase thirst, as tested by "a long duration simple reaction time task and a rapid visual information processing task, and a mood questionnaire" completed once before and three times after caffeine administration. "Regular caffeine consumers appear to show substantial tolerance to the thirst-increasing but not to the performance and mood effects of caffeine"[12].
A study using U.S. Navy SEAL trainees as subjects who underwent "72 h of sleep deprivation and continuous exposure to other stressors" found that "moderate doses of caffeine can improve cognitive function, including vigilance, learning, memory, and mood state"[13].
A study using "well-trained cyclists" as subjects found that caffeine "in a performance bar can significantly improve endurance performance and complex cognitive ability during and after exercise." "Cognitive function measures" included "computerized Stroop and Rapid Visual Information Processing tests"[14].
And from [10]: "clonidine reduced alertness, impaired many aspects of performance and slowed saccadic eye movements; caffeine removed many of these impairments."
—
Problems with other answers:
A problem I have with the study[7] referenced in Naomi P Saphra's answer is that alertness was essentially self-rated using MAPSS (Mood, Alertness, and Physical Sensations Scales), which is described in [8].
MAPSS is a set of items that ask how one feels with respect to some criterion. For example, an item included on the alertness scale is as follows: "I feel mentally alert / attentive / able to concentrate / observant"; it looks like the study presented one of these (e.g., "I feel mentally alert") for each item to each subject, and had the subject rank how he/she felt (e.g., how "mentally alert" he/she felt) on a 9 point scale (ranging from "not at all" to "extremely").
The study concludes that "no net benefit for alertness is gained, as caffeine abstinence reduces alertness and consumption merely returns it to baseline." Such a conclusion cannot be reached using only data collected about how alert the subjects said they felt.
—
Citations and footnotes:
[1]: http://en.wikipedia.org/wiki/Caf…
[2]: http://en.wikipedia.org/wiki/Epi…
[3]: http://en.wikipedia.org/wiki/Lip…
[4]: http://www.psychologytoday.com/b…
[5]: http://josepharcita.blogspot.com…
[6]: http://www.ketotic.org/2011/02/b…
[7]: http://www.nature.com/npp/journa…
[8]: http://www.nature.com/npp/journa…
[9]: http://hyper.ahajournals.org/con…
[10]: http://jop.sagepub.com/content/1…
[11]: http://csjarchive.cogsci.rpi.edu…
[12]: http://www.ncbi.nlm.nih.gov/pubm…
[13]: http://jtoomim.org/brain-trainin…
[14]: http://www.ncbi.nlm.nih.gov/pubm…
[15]: http://www.wellesley.edu/Chemist…
[a]: This happens because caffeine is a nonselective antagonist of adenosine receptors, acting as a competetive inhibitor[1] (caffeine binds to adenosine receptors without activating them, in place of adenosine, which would activate them), and "endogenous adenosine receptors inhibit epinephrine release from the adrenal medulla and suppress plasma norepinephrine levels"[c][9] (so activated adeosine receptors contribute to lower levels of epinepherine). Circulating epinepherine levels therefore increase when caffeine prevents adenosine receptors from being activated. [15] is relevant.
[b]: Increased epinepherine levels also stimulate glycolysis, but increased availability of free fatty acids can decrease glycogen utilization[1].
[c]: Interestingly, [10] suggests that "the beneficial effects of caffeine seen in low alertness states" may be attributed to caffeine counteracting "reductions in the turnover of central noradrenaline."