Each person has a cycle where they go between waking and resting state. The trick is to go to bed when you're headed into resting state. And if you wake up and can't go back to sleep, get up and do something for X number of minutes until you go back into resting state.
For me the cycle is about 45-50 minutes.
This also means that if you wake up naturally before your alarm that means you're in the waking state, so it doesn't matter how sleepy you might feel, just get up and get on with your day. Going back to sleep will waste 45*2 minutes at least.