Modafinil is a eugeroic, or ‘wakefulness promoting agent’, intended to help people with narcolepsy. It was invented in the 1970s, but was first approved by the American FDA in 1998 for medical use. Recent years have seen its off-label use as a ‘smart drug’ grow. It’s not known exactly how Modafinil works, but scientists believe it may increase levels of histamines in the brain, which can keep you awake. It might also inhibit the dissipation of dopamine, again helping wakefulness, and it may help alertness by boosting norepinephrine levels, contributing to its reputation as a drug to help focus and concentration.
In addition, the cognitive enhancing effects of stimulant drugs often depend on baseline performance. So whilst stimulants enhance performance in people with low baseline cognitive abilities, they often impair performance in those who are already at optimum. Indeed, in a study by Randall et al., modafinil only enhanced cognitive performance in subjects with a lower (although still above-average) IQ.

The use of cognition-enhancing drugs by healthy individuals in the absence of a medical indication spans numerous controversial issues, including the ethics and fairness of their use, concerns over adverse effects, and the diversion of prescription drugs for nonmedical uses, among others.[1][2] Nonetheless, the international sales of cognition-enhancing supplements exceeded US$1 billion in 2015 when global demand for these compounds grew.[3]