I basically have an undiagnosed anxiety disorder, and one of my symptoms is massive insomnia. It is called onset insomnia because it is not being able to fall asleep. I also can't stay asleep, but that is less frustrating to me.
Well, yesterday I was sitting at work after not having slept (for more than a few hours at a stretch) in several days, and I looked up how to sleep. I could take melatonin, but I am afraid I would not be able to wake up on time. There are light blocking goggles to keep light from interfering with your melatonin production for a few hours before bed, but I have read that some people just don't produce a lot of melatonin. So those are both ideas to consider, but I have implemented some other things: white noise, warmer than ordinary room, gentle transition to waking up, darkness, and a worry book. A worry book is to write down the things you are mulling over so that you can think about them later during designated awake time.
Last night was when I used every single sleeping strategy, and it was pretty successful. One thing that keeps me waking up every few minutes after I fall asleep is, is my alarm on? I set my phone to go off 4 or 5 times at five minute intervals. For last night I set it to vibrate the first two times, and I put it in my pillowcase. That meant I could sleep in earplugs. I also spread my bed canopy into a tent so less light would get to me. The nicest part of my sleep correction is my roommate's space heater, which has a fan that produces white noise incidentally while it keeps our room tropically warm. I loved it so much that I think I will buy that exact one and use it on low or no heat if the heater gets fixed. I was so pleased to get home at 11:30 and just sink into my bed, because even though I can never sleep, optimism bias dictates that I fully expected to be able to sleep, because look! earplugs!
And I had a pretty restful night. I only woke up twice to check my alarms. Then I woke up twice to get water and needed more water in the morning. Generally I only wake up to get water once, sometimes not at all. I think the heater dehydrates me. And I had a nightmare that I was stuck in an empty ice chest. I slept from 12 to 5:45, and probably spent most of an hour awake during that time, and it was nonetheless the best sleep I have had since three weeks ago when I slept for nearly 40 hours between Friday and Sunday.