I discuss melatonin's effects on sleep & its safety; I segue into the general benefits of sleep and the severely disrupted sleep of the modern Western world, the cost of melatonin use and the benefit (eg. enforcing regular bedtimes), followed by a basic cost-benefit analysis of melatonin concluding that the net profit is large enough to be worth giving it a try barring unusual conditions or very pessimistic safety estimates.
I was prescribed melatonin for a sleep complaint some years ago and noticed no detectable improvement: I didn't get to sleep more easily, wake up less during the night, or feel more refreshed in the morning. What might explain this?
Melatonin is best for sleep quality improvement with people who are above 40 as endogenous melatonin production usually starts to decrease from 30. You're much younger than that, so sleep disturbances are less likely to be caused by low night melatonin levels (so supplementary melatonin is less likely to be a significant remedy).
1AngryParsley
It could be that you weren't taking enough. Another major factor is your bedtime routine. Exercise, bright lighting, and other stimulating activities (video games, emotionally-engaging movies) can discourage sleep.
Full essay: http://www.gwern.net/Melatonin