I've been in the Navy for a long time and insomnia comes at the worst times.
This past year I've been working shiftwork ashore: two 12 hour days (0600-1800), followed by two 12 hour nights, then 5 days off. The cycle is hardest after my second night shift.
Last year, when I was still on a ship, I listened to a radio interview with a Psychologist who researches sleep aid techniques. The best his lab came up with is this:
1. Choose a word (6-10 letters or thereabouts)
2. Start with the first letter of the word and think of as many words as you can starting with that same letter.
3. If you got 2 or 3 or 4 seconds without coming up with a word for that letter move onto the second letter of the original word.
4. Think of as many words as possible starting with the second letter.
5. Continue until you fall asleep.
The reason this method works goes something like this. As we fall asleep, our mind opens up and starts allowing random neural firings. It's why we cannot concentrate when we're falling asleep and why we get those little micro dreams as we're drifting off. The above technique puts the cart before the horse. As you randomly think of those words, you are causing very fast random thoughts and tricks the brain into going to sleep.
I used this technique during my last four months sailing and never had a problem getting to sleep until about 8m seas kicked in during a Nor-easter.
Now that I'm doing shift work and sometimes need to sleep during the day, I use this method and can drift off usually in less than 5 letters (10-20 words per letter).
The more you use it, the easier it becomes.
I found an article describing the method.
https://www.theguardian.com/lifeandstyle/2016/jul/15/shuffle-thoughts-sleep-oliver-burkeman