As the day progresses your body burns through ATP for energy. The adenosine from the ATP builds up as this process goes on. When this happens, it activates receptors on acetylcholine neurons in the ARAS, a part of the reticular formation that makes your brain sleep, thus making you sleepy. Coffee (caffeine) and tea (theophylline) blocks adenosine from binding to these receptors, keeping you awake. And that’s a shorthand version of how caffeine keeps you up to study for hours and hours.