The laws of taking medicines on Shabbat are found in the Shulchan Aruch (Orach Haim, 328), and you can find a good English overview of these laws in the work Shmirat Shabbat KeHilchatah (notably chapter 34).
In general we can separate the law into several categories. Firstly, in cases of life-threatening situations not only are medicines allowed, but anything that is needed to save the life is warranted. So, for example, one must drive such a person to hospital etc, even though it involves a Torah prohibition.
Next is the case of people who are sick, but not in a life-threatening situation, like someone bedridden with a bad cold or serious migraine attack. In such cases, medicines may be taken, as there is no Torah law prohibiting the taking of medicines that were made before Shabbat - one is not cooking the medicine, grinding the plants to extract the drug, or doing anything that is forbidden on Shabbat. One is merely swallowing the tablet.
The third case involves people who are not bedriddden, but feel "under the weather" ("michushim" in Hebrew). Here, the Rabbis made a decree to ban the taking of medicine, as they were concerned that it may lead to the grinding of plants to make the drugs. [It is interesting to point out that there is no prohibition of grinding products that were already ground once before. This being so, in cases where one is allowed to take medicines - such as a bedridden person - one may grind the pill up, as our pills were already ground in the manufacturing process]. The Rabbis only banned medicines in this case, and not with a seriously sick person, as they did not want their decrees to cause undue hardship.
This being said, we need to examine the question of medicine for someone with ADHD - attention deficit hyperactivity disorder. There are several reasons why it seems to me that taking these medicines is permitted.
Firstly, someone who has started on a course of pills before Shabbat may continue to take them even on Shabbat (see Shmirat Shabbat KeHilchatah, 34, 17).
Secondly, it is not clear that someone with ADHD is considered at all "sick" or "under the weather". See for example Shmirat Shabbat KeHilchatah (ibid 19) that birth control pills are not forbidden, and the footnote there (in the Hebrew edition) explains that only cases where someone is in physical pain or weakness is forbidden to take medicines. It could be that they have the law of a healthy person, in which case the taking of medicines is the subject of debate (see the Shulchan Aruch ibid, 37, and the Mishna Brurah 120). Even those generally strict on this question (ie. the Ashkenazim) could take the lenient opinion as an extra reason for leniency, together with the other reasons I cite.
Thirdly, the medicines for ADHD that exist today do not cure the condition - they merely treat the symptoms of hyperactivity and lack of ability to concentrate. It would seem that the Rabbis only forbade medicines that bring about a cure. (See Yalkut Yosef 328,52).
Lastly, there is much discussion about the extent to which this rabbinic decree is still in force today when the underlying reasoning for it (ie that one may be led to grind the plants to make the medicine) does not seem to apply any more. (See the Tzitz Eliezer, volume 8, 15, 15 for a lengthy discussion of this issue). Even though all the modern day poskim hold that we do apply this decree, there is room to take the lenient rulings together with long-term medications such as in the case of ADHD.