If I've been lying in bed for 15-20 minutes with no signs of dropping eyelids, I get out of bed and go to another room. This is pretty critical, I have found. I don't bother turning on any lights. I go into my living room or go outside if it's a nice night. I either spend some time practicing mindfulness or do a 10-minute meditation on my breath.
During the day, I use Headspace, an app for mobile devices that you can also access through your laptop that has lots of different meditation practices and teaches you gently how to meditate correctly. But at night, I want to avoid all screens because the blue light instantly perks me up. So, instead, I just try to count my breaths in and out...
Now it's time to repeat my going to sleep routine from the beginning of the night. I get comfy in bed, turn on my reading light, and do a little reading. This part does require me to be a little picky...
After 10-15 minutes, if I still can't sleep, I get up AGAIN.
This time I go into the living room and try either one of the other strategies listed or I try to read a little out there. Then repeat step 2 until sleep finally blesses me.
Other things you can try when you're out of bed include art, needlework, light cleaning, writing down what you are worried about, writing a letter/card to a friend or loved one, getting a light snack or something to drink, or working on a puzzle...
So, the next time you are staring at the ceiling and listening to your house creak at 3am, try out my list and see what works for you. Don't forget to let me know what works and what does not.