Here is the gist of why caffeine wakes us up.
[Taken from the article I wrote about caffeine and headaches]
Caffeine and adenosine have extremely similar molecular structures and caffeine bonds to the adenosine receptors when ingested. Adenosine molecule, when bonds to the receptors, is responsible for the feeling of being tired. When caffeine binds to the receptor it tricks the body into thinking it’s not “bed time”. It is a prodigiously complex process but thats the gist of it.
Also, caffeine has an effect on the sympathetic nervous system.