A counterfactual is a mental simulation where you think about something that happened, and then imagine an alternate ending.

Kathleen Vohs, a professor at the University of Minnesota, says we come up with counterfactuals all the time.

"If you drive home from work today, and you get into a car accident, that would be terrible," she says. "And you may start thinking about why that happened. If you took a new route home from work, one of the counterfactuals may be, 'Now if only I had stuck to my usual way of going home, this wouldn't have happened.'"

"Counterfactual thoughts are generally useful for us in terms of providing a set of options that we might act upon in the future," he says. "And this can lead to improvement. It can lead to learning from experience."

But counterfactual thinking isn't always so constructive. Counterfactuals sometimes appear when they're not needed; they can also fail to appear when they would be most useful.

This week on Hidden Brain, we look at why some events prompt these "What if?" questions, while others do not.

This episode was produced by Rhaina Cohen and Parth Shah and edited by Tara Boyle. Our team also includes Jenny Schmidt, Thomas Lu and Laura Kwerel. You can follow us on Twitter @hiddenbrain, and listen for Hidden Brain stories each week on your local public radio station.