Rabbi Bodner (Halachos of Refuah on Shabbos) writes (page 242) that insomnia is classified as a מיחוש בעלמא, an "ailment" that isn't serious. (though if someone suspects that they suffer from chronic insomnia, they should see a sleep specialist after Shabbos)
The rules for מיחוש בעלמא are found in chapter 1 of that work; the most basic rule being that one may not do anything medical about it, though there are exceptions to this rule.
Here are some relevant excerpts:
Chapter 1, section C/a:
Some Poskim permit the use of medicines on Shabbos for persons suffering from painful ailments if the person crushes the medicine into a food or drink before Shabbos. The medicine in the food or drink must be dissolved in the food before Shabbos, and must be undetectable.
Rav Moshe Feinstein, however, was skeptical of this היתר, only allowing it in certain instances. (אגרות משה או"ח ח"ב, סי' פ"ו)
Chapter 1, section e/6 (Sleeping Pills):
Some Poskim permit insomnia sufferers to take a sleeping pill on Shabbos, because a sleeping pill does not heal.
Other Poskim liken a sleeping pill to medicine, and prohibit it, unless the lack of sleep would debilitate the sufferer to the extent that he would be Incapacitated (חולה שאין בו סכנה), in which case taking medicine is permitted.
One more thing: if something is a regular food item, it doesn't count as a "medicine," even if it has medicinal properties, as per Shulchan Aruch, Orach Chaim 328:37.
Now, as for your specific questions:
I'm not quite sure if this is a tea that's drunk by healthy people....there are many types of tea I have never heard of, so let's assume that it's normal to drink.
- powder and tablets -- allowed (some opinions)
This is something medicinal, so it would be allowed according to the "some Poskim" cited by Rabbi Bodner above, though all agree that if the patient were to become a חולה שאין בו סכנה due to sleep deprivation, that he would be allowed to take this medicine.
Even according to those opinions that insomnia cannot be treated medically on Shabbos, if it's baked into food before Shabbos, then all agree that it's fine, provided that the medicine is not detectable. See the discussion of crushing medicine into food or drink, above.
- melatonin patch -- allowed (conditions apply)
A patch that slowly releases medicine is allowed to be used on Shabbos, because the גזירה against medicines on Shabbos was only ever against administering medicine on Shabbos, and not against medicine working on Shabbos (Bodner, page 12). So if the patch was put on before Shabbos, there are no issues with it. Assuming no other Shabbos rules are violated, putting on a new patch should be the same as powder and tablets, discussed above.
But besides for the medical aspect of putting it on), putting on and taking off patches are complicated issues. Not knowing much about the makeup of melatonin patches, I would suggest that they should be dealt with in the same manner as band-aids -- opening a paper package is okay for a מיחוש, but the paper protecting the sticky part may be problematic, so that should be taken off before Shabbos, if possible (re-sticking it on is fine, because un-sticking it a second time is not a problem); however, if it wasn't prepared before, it may be taken off. It is preferable not to stick a band-aid to itself. It's also preferable not to remove it, if it might cause hairs to rip out; however, if it will cause pain, then it's okay to take it off. (Bodner, 328-330)
Page number references are in Halachos of Refuah on Shabbos by Rabbi YP Bodner, Jerusalem 2008