In many corners of our productivity-obsessed society, naps are associated with laziness. Everyone should sleep eight hours at night, the thinking goes, and work all through the day.

But that's backward. After all, the solid eight-hour block of sleep is a relatively recent invention. Until the Industrial Age, historian Roger Ekirch has found, most people routinely woke up for several hours in the middle of the night, and supplemented their "segmented" sleep with a nap in the afternoon.

In other words, napping is natural. It's also good for you. A short nap, research shows, can produce all sorts of benefits, from increased alertness to improved memory (more on those below).

Many of us fight the urge to lie down every day at 2 pm. Perhaps we shouldn't.

The formula for the ideal nap

1) Nap in the afternoon. Most people naturally feel a dip in energy six to seven hours after they wake up — which often works out to 2 pm or so. Some researchers even think the afternoon urge to nap is evolutionary: As William Dement, former director of Stanford's sleep center, told the New York Times, "It seems nature definitely intended that adults should nap in the middle of the day, perhaps to get out of the midday sun."

Regardless of the biological reason, this afternoon lull is the perfect time to take a quick nap. It's also not too close to bedtime — so it won't interfere with you falling asleep at night.

2) Find a dark, comfortable, quiet place. You may feel tired enough to fall asleep anywhere, but sleep researchers find that these controllable factors play a huge role in how easily and quickly people can fall asleep.

3) Figure out how long to nap. Because your brain progresses through a series of distinct stages after you fall asleep, naps of different lengths can have surprisingly different effects.

In most situations, a brief nap of 30 minutes or less (the solid line in the graph above) is ideal, because your brain never advances past the early stages of light sleep. Experiments find that these naps don't lead to much grogginess and produce a relatively short burst of improved alertness.

During mid-range naps of 45 to 90 minutes (the dotted line), you brain enters what's called slow-wave sleep, and if you nap more than 90 minutes or so (the dashed line), you'll enter REM sleep, during which most dreaming occurs. Both of these lead to periods of post-nap grogginess (scientists call it sleep inertia).

But interestingly, experiments have found that those longer naps lead to longer-lasting improvements in alertness for the nappers — so if you want to improve your performance for, say, a six-hour drive, taking a relatively long nap beforehand (and giving yourself time to recover after) could be the way to go.

4) Set an alarm. This might seem obvious, but for most people it's really hard to wake up when you intend to, and longer naps can backfire.

5) Optional: Drink some coffee first. It sounds crazy, but the coffee nap is very much a real thing. Quickly downing a cup of coffee (or other caffeinated beverage) and then napping for 20 minutes or less can have some surprising benefits.

The reason is that it takes around 20 minutes for caffeine to move through your gastrointestinal tract and your bloodstream, to enter your brain. What's more, caffeine makes you feel more energetic by displacing a chemical called adenosine, which produces a feeling of tiredness — and sleep naturally clears adenosine from your brain.

That means when you wake up after 20 minutes and the caffeine arrives, it has less adenosine to compete with, amplifying the effect of the caffeine. A few different studies have shown that people who take coffee naps are more alert and perform better on memory tests than people who drink coffee or take a nap alone.

The surprising benefits of napping

1) Naps increase alertness. One of the earliest studies looking at napping, carried out in the 1990s by NASA, found that commercial pilots who took naps during flights (while accompanied by a co-pilot) committed significantly fewer errors and had faster reaction times afterward.

Similar findings have since been made in a wide variety of contexts — everything from paying attention to stimuli on a computer screen to driving a car at night to inserting IVs into patients in an emergency room. A short nap, it seems, gives your brain needed rest to perform better afterward.

2) Naps improve memory. A handful of other studies have shown that napping similarly improves memory performance. It seems to specifically improve what's known as declarative memory: the ability to recall specific pieces of knowledge (rather than procedural memory, which involves remembering how to carry out tasks).

In these experiments, people who try to memorize a set of information and take a short nap before being tested on it perform better than those who stay awake during the interim. This likely occurs because the brain consolidates new memories as it sleeps — and it means napping might be especially useful for students studying for tests.

3) Naps might also boost your creativity and problem-solving ability. There hasn't been as much research into these benefits as the prior two — but the work that has been done suggests they're quite real.

Earlier studies on sleep in general (not naps) found that a period of sleep helped people figure out non-intuitive solutions to problems way more quickly than people who stayed awake. More recent research found that an hour-long nap improved people's performance on an abstract association test, used to measure creativity. Other work has even found that naps appear to help infants grasp abstract relationships between words more easily.

4) Naps are pleasant. Amidst all this talk of productivity and alertness, it's easy to forget about one of the core benefits of napping: It feels good. Sleeping is pleasant — and naps, which tend to slow down the passage of time, making a 20-minute descent into drowsiness feel like a much longer period of relaxation, give you the most bang for your buck.

We have data to bear this out. In 2006, the economists Daniel Kahneman and Alan Krueger looked at how stressed, happy, sad, or worried people felt while doing a variety of daily activities. Napping wasn't quite at the top of the most preferred activities overall (that was sex), but it was above recreational computer use and shopping. Napping is one of life's simple pleasures, and, better yet, it's free.

VIDEO: Hacking your brain with lucid dreaming