My dad used to suffer from insomnia, holding imaginary meetings in his head late into the night. I'm the same way.
One stress-relief technique from Johns Hopkins is a breathing + mantra exercise. I find their mantra recommendation cringey:
Breathing in I am calm, breathing out I am coping.
Mantras, guided imagery, and autogenic training are generally hard for me, because I feel pressure to "stay focused on the mantra."
My weird trick is to replace the mantra with free-form inner-monologue nonsense syllables. Here's an example:
Nimbla doobla deeble dee... simba dimba lima nooble doo...
I let the pacing and "mental voice" vary, but mainly aim for a sleepy-sounding tone.
At the same time, I let myself visualize nonsense images. My visual imagination isn't very vivid, and I don't try to create any specific images. It's nothing more than a patchy and low-res mental screensaver. Not even this exciting:
This puts me right to sleep.
If you have refinements of anti-insomnia tricks that aren't on bog-standard lists like this one, go ahead and add them in the comments!