As a child I would find it difficult to sleep sometimes. This was likely a result of the nervous energy kids have and an early bedtime. As a young adult I got into a rhythm where I could fall asleep like a light switch not even remembering laying down before I was out. Hitting middle age however I've found it tricky to fall asleep at times. Granted part of it is the smart phone addiction and the many many many online threads/groups I manage but there is more to it than that I think.
Somewhere along the line I developed a coping mechanism. Since my brain racing a million miles an hour was the cause of the issue I chose to refocus that mental energy into something simple yet precise. I think of a circle. That's it you say? A circle? Sounds silly. Perhaps it is but by imaging a rough hewn circle in a blank space I've given myself something to focus on. Then I try to think about the precise edges necessary to make it perfect, I mean really think about them.
I'll lay there in bed as still as I can imaging an empty void and each curve of the shape until it's the only thing in my mind. I could never "clear my mind" like was suggested to me when learning to mediate but give me one thing to focus on and I can do it till I am exhausted which is often what happens. It's isn't fool proof but 9 times out of 10 this is just the trick I need (once I've finally turned my cell phone off).