The most obvious answer can be stated in one word: sleep.
Since the above answer is not always possible, people often find other solutions as to what to do when they've not had enough sleep.
One popular choice, when one notices a symptom is to ignore it. This often works for short periods of time, but inevitably leads to an even more severe case of sleep deprivation.
Another very common solution that is often applied when the first two have failed, is to take drugs. Drugs like caffeine tend to diminish the effects of sleep deprivation. Caffeine is often found in coffee , a dark brown drink that is often palatable when mixed with milk and loads of sugar. Unfortunately, caffeine has addictive properties and often leaves people unable to function in any way until they have had their morning cup of coffee.
Still, the best thing to do if you find yourself unable to function after having gone for many, long hours without sleep, is to cancel your appointments, find a nice cosy place to lie down on a couch, bed or under a dumpster, shut your eyes and go to sleep .