I only get it when I'm really, really tired and I fall asleep before 9pm (because I'm naturally a nightowl and if I go to sleep too early, that throws my whole rhythm off) so then I wake up between 3 or 4 regular as clockwork and I just get up and do something until I'm tired and then I fall back asleep.
I never lay there and TRY to sleep. It just doesn't work.
I can avoid it, if I know I'm tired, by taking an afternoon nap, which enables me to stay awake until after 11, and then I don't have any problem sleeping through to six or seven.
If it's because I'm worried about someone or something, I just read and deal with it. Because I know sleep won't come until I stop worrying.