Watching the 2016 election unfold was more of an emotional roller coaster than I could have ever anticipated. As a Canadian living in Washington, DC, I can’t vote in this country. Yet I’ve been riding on waves of shock and despair.

On Tuesday night, I saw some of my American friends who supported Hillary Clinton eat their supper, feeling hopeful, thinking it would be an early night. They were sure the Democrats would tie this one up.

The minutes tick-tocked ... until the heart-stopping moment when they realized Donald Trump could become president. The polls had been wrong. Their friends had been wrong. Their trusted news sources had been wrong. How could this happen?

They felt blindsided, misled, and silly — as if hit by a breakup they’d known deep down could come but didn’t want to see. The tears fell. Maybe it was all a bad dream.

They awoke yesterday to the realization that it wasn’t a bad dream. Deep sadness and anxiety set in. Some said they didn’t want to get out of bed. Others told me they’d move to Canada or hit the bar right after breakfast.

Searching for ways to understand this profound election heartbreak — which seems more acute and gut-wrenching than any political event I’ve observed in my years here — I turned to the literature on psychology, human behavior, and politics. And I found some comfort.

The reason we’re hit so hard by an election outcome is because of something psychologists call the "false consensus effect." We tend to overestimate the extent to which other people share our views, and when we learn they don’t, we’re caught off guard, flabbergasted.

In political elections, Harvard Kennedy School behavioral scientist Todd Rogers told me, he’s consistently observed both sides think their side is about to win. That means that in every election cycle, regardless of media rhetoric or polling data, half of the population is always going to be sucker-punched. And because we tend to be friends with people like us, work with people like us, and read news sources that confirm our worldview, getting hit by a reality beyond that can cut deeply.

Those partisan defeats can be more crushing to individuals than violent, national catastrophes. In one study, Rogers used a data set that continually measured people’s feelings about political loss (specifically after the 2012 election, when Obama was reelected) against two national tragedies: the Boston Marathon bombing and the Newtown shooting. He and his co-authors found that the sadness impact of losing an election was twice as intense as the sadness they felt after the national tragedies, and he thinks this comes down to identity.

"Partisanship is defining more and more of our mental, social, and geographic lives," Rogers explained. "So when that part of ourselves gets dealt a pretty significant blow, it’s a blow to the whole self for a little while."

To make matters worse, the pain of losing something is greater than the joy of winning something. That can be explained by the "prospect theory" in psychology. Consider this famous experiment conducted by the behavioral economists Daniel Kahneman, Jack Knetsch, and Richard Thaler. Half of the study subjects were given a mug and asked to sell it; the other half were asked how much they'd be willing to pay for the same mug. The "potential sellers" who already owned the mug valued their special object at about double what the "potential buyers" were willing to pay.

Now, giving up a mug isn’t the same as losing an election — but the way we overvalue something we already possess compared with something we don’t shows how much we hate and desperately try to avoid losing.

There is some good news in all this. In a few days, for people who see themselves on the losing team, the pure sorrow of losing is likely to fade. The social psychologist Dan Gilbert has found that we overestimate the intensity and duration of emotional events, so that when something good or bad happens to us, those feelings of elation or despair don’t last as long as we think they will. You can see this in the research on people who suddenly become paraplegics or who win the lottery: After that disruptive event, they very quickly return to their baseline happiness.

To be clear: This election has inflicted many other kinds of wounds on identity likely to leave many groups — African Americans, Muslims, LGTBQ people, people with Obamacare, immigrants, the working class — hurting for quite a while. But partisan identity, it seems, is probably more resilient than we think.