Smart drugs or “nootropics” have become extremely popular over the last few years, with users ranging from top CEOs and tech leaders, to gamers, and finally making the way to the fitness industry. These compounds vary in mechanism of action and chemical structures, but overall people use them to increase cognitive function, focus and mental performance.
One of the most potent families of smart drugs are known as racetams. There are 17 different racetams, but this article will focus on the most studied and most potent ones and explain the history, chemistry and mechanism of action, as well as how to use them to boost focus and mental acuity.
Related - What are Nootropics
The man we have to thank for these wonder smart drugs and who originally coined the term “nootropic” meaning “towards the mind,” is Belgium research scientist Dr. Corneliu Giurgea. While trying to develop drugs to induce sleep, he postulated that the chemical structure of such a drug should be related to GABA, the body’s main inhibitory neurotransmitter (glutamate is the body’s excitatory neurotransmitter). He cyclized GABA to form the backbone structure of all racetams, 2-pyrrolidone- chemically known as a lactam, which was used to synthesize the first racetam, piracetam. 
The nitrogen atom in the ring structure makes it very easy to derivatize and attach other functional groups to the backbone structure that can vastly alter things like half-life, binding affinity, and overall effect.
Piracetam did not induce sleep as hypothesized, but Dr. Giurgea and his team noticed enhanced cognitive function which led them in this new direction to make more racetams. Piracetam, first synthesized in 1964 works by interacting with the NMDA and AMPA receptors in the brain, which are your body’s excitatory receptors that normally glutamate binds to and activates.
Piracetam is a positive allosteric modulator, which means that it binds not to the main active site where glutamate binds, but to a secondary binding site that enhances the receptors activity once glutamate binds.  By doing so, piracetam can increase neuron firing and facilitation of information throughout the brain. However, despite almost 30 years of studying piracetam, there still is no clear mechanism of action.
What is known is that piracetam can increase blood, glucose, and oxygen flow to the brain (your brain uses 15-20% of your total blood and up to 50% of your body’s glucose), delay mental decline (most of the research is on this topic), improve memory and cognition, improve cell membrane fluidity, and is EXTREMELY safe (with an estimated LD50 greater than table salt).  Mitochondria membrane fluidity is very interesting property of piracetam because of the research suggesting that mitochondrial dysfunction may have a causal role in Alzheimer’s disease. 
For this reason, many people use piracetam as a preventative measure.
The main drawback for piracetam is dosing. It seems to take high doses in order to be noticeable, especially for an appreciable experiential effect. The largest studied dose is 1600mg 3x day, which is almost 5g of product. I have seen some data suggesting 800mg 3x a day can have positive effects on memory and cognition.
Although there are many benefits for using piracetam, chemists have since synthesized newer and more potent racetam molecules using the 2-pyrrolidinone backbone. Since high doses are needed for piracetam to be effective, over 17 different racetams have been synthesized and studied to replace piracetam.
Aniracetam was first synthesized in the 1970s by Swiss pharmaceutical company Hoffman-La Roche. In order to attempt to make a more active version of piracetam, aniracetam differs in structure by a p-anisoyl group which makes the compound extremely lipophilic (fat soluble) and easier to enter cell membranes and the Blood-Brain barrier.
Most of the research on aniracetam shows that it is also an AMPA modulator (like piracetam), and has been shown to decrease the rate desensitization of AMPA.  However, interestingly it does seem to have a cholinergic effect (increase in choline), where piracetam doesn’t.
One study showed that aniracetam potentiated the alpha 4 beta 2-type currents, which is one of the electrical currents evoked by acetylcholine in the brain, by 200-300%.  This would suggest that aniracetam can directly increase acetylcholine production/usage. This may be the reason why it can promote cognitive enhancement, as reported in users.
The only other solid research for aniracetam and improving memory/learning is a study that showed it can reverse alcohol-induced cognitive impairment from prenatal in rats.  Despite the lack of research, anecdotally aniracetam seems to have a positive effect on focus. Typical doses of aniracetam are 1000-1500mg/d, split into 2 doses, which is considerably less than piracetam.
Probably my favorite of the racetams is phenylpiracetam. Structurally, phenylpiracetam differs by the addition of a phenyl ring on carbon 4 of piracetam (there are 2 isomers R and S, with the R being the more active isomer, however it’s usually supplied as a racemic mixture).
This addition not only makes the molecule extremely more lipophilic, with nearly 100% bioavailability, but also drastically changes how it works in the body, as the phenylethylamine (PEA) backbone that is found in many stimulants like ephedrine and amphetamine is now present. Phenylpiracetam was first developed in 1983 in Russia as a medication designed for Russian cosmonauts to help mitigate the sustained stress of working in space. Phenylpiracetam works very differently from many of the other racetams, with evidence showing it has psychostimulatory effects, as well as improved cognitive function.
One study showed that it can selectively inhibit the dopamine transporter (DAT), the protein that regulates dopamine reuptake which gives the “reward” feeling to your brain (many prescription drugs for ADHD act as DAT inhibitors). It makes sense that phenylpiracetam would act this way since it contains the phenylethylamine backbone, like most ADHD medications.
This study also showed anorexic effects of phenylpiracetam, as it reduced weight gain and fat mas in obese rats and prevented weight gain in western-diet fed mice.  This is the only racetam known to have this effect, and is even on the WADA banned substance list. Phenylpiracetam is said to be 20-60X stronger than piracetam, as well as having a wider range of benefits including physical performance enhancement and one study showed it can help increase communication between your brain’s two hemispheres. 
As far as pure cognitive enhancement, phenylpiracetam has quite a bit of research showing a positive effect. However, it should be noted that these studies are mostly in older subjects with age-related natural cognitive decline or brain trauma.
As we age, many factors contribute to this such as a decline in levels of neurotransmitters, especially acetylcholine, the density of the receptors for these neurotransmitters (GABA, NDMA, dopamine, ect), cerebral blood flow, all of which can adversely affect memory, learning, and decision making.
In one of the largest studies, consisting of 400 participants who suffered an ischemic stroke were given 200mg/d of phenylpiracetam or a placebo for one year. Researchers noted significant restoration in cognitive function and daily living activities compared to the placebo. This indicates that the drug can improve blood circulation in the brain, common with other racetams and nootropics. 
Another Russian study consisting of 99 subjects with cognitive impairment from brain swelling showed similar results as the previous study. Improvements in scores on mental state exams and questionnaires, as well as higher brain function and memory occurred in the groups receiving 200mg/d of phenylpiracetam for 30 days. Worth noting, anxiety and depression were also significantly reduced. 
Unfortunately, there are no studies with phenylpiracetam in young, healthy individuals, but there is a plethora of anecdotal evidence to suggest that phenylpiracetam can improve concentration, focus, memory, and even physical endurance/performance.
There was an interesting head-to-head study comparing piracetam to phenylpiracetam in subjects with chronic fatigue syndrome. This study involved 200 subjects split into three groups, each receiving a different drug or a placebo, and then perfomaced a series of learning and problem-solving tests.
Overall, 87% of all subjects taking 100-200mg/d of phenypiracetam had a positive response vs only 55% in the piracetam group. Specifically, an 88% improvement in the 10-word recall test was noted in the phenylpiracetam group compared to only 37% improvement in the piracetam group. 
As far as dosing, phenylpiracetam seems to work in the 100-200mg range, 2-3 times a day, as the half-life is approximately 3-5 hours. As stated earlier, this is my favorite of the racetams because of its stimulatory effect, as well as its ability to markedly increase focus and concentration without the jitters or anxiety from your typical ADHD medications.
2) Tacconi, M. T., and R. J. Wurtman. "Piracetam: physiological disposition and mechanism of action." Advances in neurology43 (1986): 675-685.
3) Grau, M., J. L. Montero, and J. Balasch. "Effect of Piracetam on electrocorticogram and local cerebral glucose utilization in the rat." General Pharmacology: The Vascular System 18.2 (1987): 205-211.
4) Mindus, P., et al. "Piracetam‐induced improvement of mental performance." Acta psychiatrica scandinavica 54.2 (1976): 150-160.
5) Waegemans, Tony, et al. "Clinical efficacy of piracetam in cognitive impairment: a meta-analysis." Dementia and geriatric cognitive disorders 13.4 (2002): 217-224.
6) Müller, Walter E., et al. "Effects of piracetam on membrane fluidity in the aged mouse, rat, and human brain." Biochemical Pharmacology 53.2 (1997): 135-140.
7) Keil, Uta, et al. "Piracetam improves mitochondrial dysfunction following oxidative stress." British journal of pharmacology147.2 (2006): 199-208.
8) Isaacson, Jeffry S., and Roger A. Nicoll. "Aniracetam reduces glutamate receptor desensitization and slows the decay of fast excitatory synaptic currents in the hippocampus." Proceedings of the National Academy of Sciences 88.23 (1991): 10936-10940.
9) Zhao, Xilong, et al. "Nootropic drug modulation of neuronal nicotinic acetylcholine receptors in rat cortical neurons." Molecular pharmacology 59.4 (2001): 674-683.
10) Vaglenova, Julia, et al. "Aniracetam reversed learning and memory deficits following prenatal ethanol exposure by modulating functions of synaptic AMPA receptors." Neuropsychopharmacology 33.5 (2008): 1071-1083.
11) Zvejniece, Liga, et al. "S-phenylpiracetam, a selective DAT inhibitor, reduces body weight gain without influencing locomotor activity." Pharmacology Biochemistry and Behavior160 (2017): 21-29.
12) Malykh AG and Sadaie MR. Piracetam and Piracetam-Like Drugs. Drugs. 2010; 70(3): 287–312.
13) Koval'chuk, V. V., et al. "Efficacy of phenotropil in the rehabilitation of stroke patients." Zhurnal nevrologii i psikhiatrii imeni SS Korsakova 110.12 Pt 2 (2010): 38-40.
14) Savchenko A.Iu., Zakharova N.S., Stepanov I.N. in Russian “[The phenotropil treatment of the consequences of brain organic lesions].”Zh Nevrol Psikhiatr Im S S Korsakova. 2005;105(12):22-6
15) Akhapkina VI, Fedin AI, Avedisova AS, et al. Efficacy of Phenotropil for treatment of astenic and chronic fatigue syndromes [in Russian]. Nervnye Bolezni 2004; 3: 28-32