Caffeine actually tricks your brain into thinking you're not tired.
It does that by impersonating a compound that signals your brain to sleep. That compound is called adenosine.
Adenosine bonds with its receptor on brain cells slowing them down, and making you feel tired.
Basically, the caffeine is stopping adenosine from slowing things down by taking its place.
So your brain cells stop getting the slow down signals from adenosine that boost blood pressure and heart rate and keeps you alert.