This way when it came to bedtime my thoughts aren't racing because I've already allowed my brain time to process them.
I think for many people when they go to bed it is the first time in the day they're not distracting themselves, and have time to just think. So all the thoughts from the whole day, or days, come rushing in at once and you feel like your "mind is racing". If you do this earlier in the day you might find it a lot easier to get to sleep.
This has been very effective for me.
On nights where I take a few minutes before conking out to just rest (not sleep, but _rest_) and let my subconscious bubble up whatever's going on, I'm always amazed at how valuable it is, and what I learn. It's almost like a bridge to the next day …
When you notice your attention going to something you don’t want it to, acknowledge the thoughts and actively redirect your attention to something you want to think about.