The oxygenation of brain depends on level of O2 in blood and cerebral circulation. The regulation of cerebral blood flow is a very complex process, which depends on glucose level, CO2 tension, K+ ion concentration, adenosine level and more.
When one is physically exhausted the dehydration occurs then the blood pressure drops and the brain gets not enough O2. When one is mentally tired (not sleeping for a long time) the glucose level in brain is lowered because glucose is used as energy for the majority of brain activities. The result of lowered glucose level is disturbed absorption of O2 in brain from blood.
During rest/sleeping the organism is very economic when it comes to energetic molecules and as there is almost no mental or physical activity less O2 is needed. Slower breathing is enough to get required amount of O2 into the brain and to “put some aside”. That’s why we don’t wake up tired.
Right after getting up the brain doesn’t get enough O2 for a few seconds because the blood pressure drops (while laying the heart and brain on the same level, standing up brain above heart) and the organism needs a little time to take care of the problem and get the pressure back to normal.
OK I just wrote a very long post and I don't even know if I explained anything...