Ritalin functions by acting on the chemicals in the brain, specifically on dopamine and norepinephrine. These chemicals are responsible for maintaining attention, behavior, and mood.
https://specialmedpharma.net/adhd/ritalin