The drug is called modafinil or Provigil.
It is generally prescribed for narcolepsy and shift-work sleep disorder (when, for example, people switch from day-shifts to night-shifts and need to adjust their body clocks).
It also has off-label uses as a cognitive enhancer. It can, in some circumstances, improve spatial planning, memory and overall cognitive performance. For this reason, it is used by militaries around the world, including by pilots flying long-distance missions.
It is a Schedule IV drug in the U.S., which generally means you can only get it with a prescription from a doctor, but it is considered low-risk for dependency or abuse. How it is treated in other nations varies widely. China considers it high-risk, whereas it is available in Mexico over the counter.
I took it once, by prescription from the White House Medical team, when I was working there. The conditions under which I did so would probably be considered typical for its use — after more than 24 hours of travel across 11 time zones. Indeed, the day I took it, we........