exercise stimulates brain regions that are involved in memory function to release a chemical called brain-derived neurotrophic factor (BDNF) which is a protein that helps in the survival of neurons and promotes the growth of new neurons. BDNF rewires memory circuits so they work better.
Memory enhancers or smart drugs or Nootropics as they are called help in improving the efficiency of neurotransmitters and its associated receptors in cognitive function. Three systems that are stimulated by these drugs which I could find are:
1) Cholineric System
2) Glutamatergic System
3) Dopaminergic & Serotonergic Systems
You can read about about them here along with links to published articles on their effects. Details of different nootropic drugs are mentioned in this article along with their effects.
Of course naturally improving concentration would be the way to go considering the hazards of long term use of drugs. Some links to the side effects are this and this