The following is an excerpt from The 7 Laws of Magical Thinking: How Irrational Beliefs Keep Us Happy, Healthy and Sane, by Matthew Hutson (Hudson Street Press, 2012).

There are certain laws of nature everyone accepts. The surest way to bring about rain on an overcast day is to leave your umbrella at home. Is your line at the grocery store moving too slowly? Switch lines. That will definitely speed it up (minus you). And if you’ve hit a series of green traffic lights that just might get you to the post office before it closes, comment on your string of success. Ah, there’s the red.

Do people really believe such actions can change their fortunes?

In recent years Jane Risen of the University of Chicago and Thomas Gilovich of Cornell have shed more light than anyone on the phenomenon of tempting fate. When they asked people to answer rationally whether exchanging a lottery ticket for another ticket would increase the chances of their old ticket winning, 90 percent said no. But when asked to answer the same question using their gut, 46 percent said yes. (Subjects thought selling the ticket to an enemy gave it the best chance of winning.) In another experiment, people said wearing a Stanford shirt after applying to the school would reduce the probability of admission.

Risen and Gilovich argue that belief in tempting fate rests, in part, on a three-step mental process. First, some behaviors make outcomes seem especially bad because they highlight the contrast between what happened and what almost happened. Being stuck in a slow grocery line feels worse if you switched into that line than if you were always in that line, because you were just in a faster line. Second, negative scenarios engage our imagination more than positive ones (as they should: a fish can feed a man for a day, but a blowfish can kill him for a lifetime). So if you’re thinking about switching lines, the thought of switching to a line that then slows down is worse than the thought of staying in a slow line, and therefore it looms larger in your head. Finally, the more you think about something, the more likely it seems.

To summarize the three-step process, negative outcomes would feel worse after tempting fate, which makes their possibility especially attention-grabbing, and thus more likely-seeming. Sounds like a rickety series of cognitive contraptions requiring a lot of effort to execute, but it’s completely automatic. In fact, Risen and Gilovich found that asking subjects to count backward by threes from 564—a cognition-hogging task—made them more likely to believe showing up to class without doing the reading would get them called on.

Tempting fate usually refers to one of two things: taking unnecessary risks or displaying hubris. Attempting to cheat death or showing presumption about success will inevitably invite rebuke. As a proverb says, “If you want to hear God laugh, tell him your plans.”

During the 2001 anthrax scare, a reporter for the Washington Post called up Scott Ian, a guitarist for the thrash-metal band Anthrax. “People keep coming up to me and saying, ‘Hey, wouldn’t it be funny if you got anthrax?’ ” he told the reporter. “I’m like, ‘Oh, that’d be hilarious.’ ” To be on the safe side, he filled a prescription for the antibiotic Cipro. “I will not die an ironic death,” he said.

“The universe seems interested not only in punishing certain behaviors but in punishing them a certain, ironic way,” Risen and Gilovich have written. We predict that negative outcomes will share some association with their antecedent—they’ll fit the crime. Therefore, wearing a Stanford T-shirt will have no effect on the weather, and carrying an umbrella will have no effect on school admissions. And naming your act Anthrax offers no reason to stock up on, say, Rogaine. (Naming your thrash-metal band Male Pattern Baldness, on the other hand...)

A predictable way to invite failure is to call attention to success. In one study conducted at Tulane, 48 percent of medical residents avoided the word quiet while on call for fear that all hell would break loose. You can even jinx other people this way. Some families in Azerbaijan seclude infants and their mothers for forty days after birth to make sure no one compliments the parents.

Risen and Gilovich argue that thinking about the positive (a streak) automatically calls to mind its flipside (the streak’s end), which then takes mental priority and thus seems more likely. They also note that we fail to appreciate regression to the mean. Nearly every game of baseball fails to become a no-hitter, but the act of saying, “We’ve got a no-hitter on our hands” sticks out and gives people something specific to blame.

Once you’ve tempted fate, there’s at least one way to make amends, to tell fate, Really, I take it all back. Giora Keinan of Tel Aviv University asked subjects a series of questions such as “Has anyone in your immediate family suffered from lung cancer?” Half the participants spontaneously knocked on wood at least once after answering.

Purchasing insurance is another way people attempt to deter fate and reduce the likelihood of an accident. Orit Tykocinski of the Interdisciplinary Center in Israel asked people to imagine going on a trip to Bangkok with or without insurance. The insured group rated the probability of illness or lost luggage lower than the other group did. Tykocinski argues that thinking about one’s insurance provides an overall sense of safety that makes negative hypothetical events less threatening and thus seem less probable.

Risen and Gilovich note that going against any superstition, no matter how silly, can feel like tempting fate because of the anticipated regret of misfortune after flouting conventional wisdom. Allowing anticipated regret to influence your judgments of objective probability is irrational, but the psychologists Dale Miller and Brian Taylor have argued that it’s not irrational to let anticipated regret affect your behavior. Regret is real. So if you’d feel worse falling into a pothole after walking under a ladder than after walking around the ladder, by all means, take the few extra steps to walk around. You won’t regret it.