When studying for several hours or pulling an all-nighter, what might actually help you is a power nap. It may seem counterproductive, but a nap will make you more alert and increase productivity.
To maximize benefits from a nap, it should be 20 to 30 minutes long. This is long enough to feel rested, but not long enough for your body to enter REM sleep, which makes it difficult to get up and causing grogginess, or sleep inertia, upon awakening. A nap should be before noontime as well so the usual rest during the night is not disrupted.
Americans are more sleep deprived than other countries whose culture involves afternoon naps. Not getting enough sleep is detrimental to your health, possibly causing memory lapses, increased stress levels, higher blood pressure, a greater risk for diabetes, psychosis, and death. Short naps will temporarily make you more alert and give you the feeling of being well-rested. Give it a try!