But if you have insomnia more regularly, especially for days at a time, or you consistently don't feel rested despite believing that you've slept, you really should try to talk to a doctor - not to ask for sleeping pills (although that may be a result), but to start the process of finding out if there's a larger problem that can be treated.
I deal with delayed sleep onset, which is livable - it just means that it takes me longer to fall asleep, and occasional insomnia on top of it wouldn't be a big deal.
But I also suffer from a REM-related parasomnia which apparently has never been officially described or named, so instead gets stuck in the "Other parasomnias - unspecified" bucket. Basically once I fall asleep, the NREM phases look perfectly normal, but once I enter REM, I suffer multiple arousals (basically I wake up, but for too short a period to be aware that I'm awake). So rather than going through REM phases, I spend that time waking up multiple times per minute.
Unfortunately so far nobody has been able to suggest a treatment. Gabapentin helps a little, but it's far from a solution.