By the time Boston Bruins centre David Krejci sailed through the neutral zone with less than two minutes left in Game 7, I was already CORFing.

I'd moved back to Toronto two weeks earlier, after a four-year stint in Australia, just in time to hop on the bandwagon of the Maple Leafs' first playoff appearance in nine years. I looked on with casual interest as Boston took a 3-1 series lead. I began BIRGing – Basking In Reflected Glory, the appropriation of success that underlies the psychology of sports fandom – as Toronto scraped back to even the series and then took a 4-1 lead late into the third period of the deciding game.

But as the now-infamous Collapse of 2013 gathered steam – Mr. Krecji across the blue line, the puck swinging back to Patrice Bergeron at the point – I was frantically switching to BIRGing's ignoble twin, Cutting Off Reflected Failure. In my head, "We're going to win it!" shifted to "They're going to blow it."

Story continues below advertisement

It didn't work. As Mr. Bergeron's soft wrist shot fluttered into the net to tie the game, synapses in the most ancient parts of my brain fired, hormone levels flared, and I got that sick feeling in my stomach that usually indicates I've personally done something very bad.

I may be crazy, but I'm not alone. This is a sports-mad country where people spend an estimated $1.5-billion on tickets and merchandise every year. Canadians decorate their cars, homes and bodies with the logos of their home teams and paint their faces at hockey and football games. Many, many of us are doomed to go through serious mood swings in February, when the Winter Olympics take place.

If this is all just an elaborate social ritual, then it's an enduring one. More than 2,500 years ago, the philosopher Xenophanes was already complaining about the rabid sports fanaticism of his fellow Greeks, which he considered a "very wrong custom."

Today, as researchers begin to explore the brain activity of diehard sports lovers, they're discovering that Xenophanes only had half the story: Our feverish devotion to professional sports franchises is as much biological as cultural.

"When we talk about fan behaviour," says Eric Simons, a California-based science journalist and author, "what we're really talking about is human nature."

Watching is like doing

This summer, Australian researchers at the University of Western Sydney published a study in which volunteers lounged comfortably in reclining chairs and watched a bland video of someone walking and running. The faster the person on the screen ran, the higher the pulse and breathing rates of the spectators rose, along with elevated blood flow and muscle nerve activity – as if, in some odd way, their reflexive responses had difficulty telling the difference between seeing an action and doing it.

Story continues below advertisement

In fact, that's exactly what's happening, explains Mr. Simons. When you throw a ball, you fire a certain subset of neurons in your premotor cortex, the part of the brain that controls the movement of our limbs. When you watch someone throw a ball, about 20 per cent of those same neurons fire. This "mirror neuron system" underlies our sense of empathy and is perhaps what allowed humans to develop language, according to some researchers.

For sports fans, it means that you're right there in the game, swinging at every pitch and bracing for every bodycheck.

This instinctive response isn't limited to your neurons: Your hormones also rise and fall with the fortunes of your team. In men in particular, testosterone levels increase in preparation for any challenge to their status, says Justin Carré, a professor (and ex-hockey player) at Nippissing University in North Bay, Ont., who studies "social neuroendocrinology" – how hormones interact with the brain to influence social behaviour.

"Before a sports competition, testosterone will rise in anticipation, then it will rise even more during the game in winners than in losers," Dr. Carré says. "And those differences will mean something for subsequent competitive and aggressive behaviour."

An identical effect has been seen in fans watching World Cup soccer finals and college basketball games, in both men and women. You might think this is a social construct – that Leafs fans (more so in men, but it happens in women too) get a testosterone boost when their team beats the Senators because they're looking forward to lording the victory over their Sens-supporting frenemies. But the response seems to be wired even more deeply than that: Brazilians researchers studying fish have shown that when a tilapia watches two other tilapia fight, its testosterone levels increase. Watching, to certain parts of the brain, is just like participating, and give you many of the same neural and hormonal rewards and penalties.

The result? In the week after the New England Patriots lost the 2008 Super Bowl in a heart-stopping upset, deaths from heart attacks and other cardiovascular causes in New England leapt by 20 to 24 per cent, according to a study appearing this month in a medical journal called Clinical Research in Cardiology. In contrast, after the Pittsburgh Steelers won in 2009, local cardiovascular deaths dropped by 25 to 46 per cent.

Story continues below advertisement

Other studies have found that traffic accidents rise in cities whose teams have just won a close game, possibly because the testosterone boost associated with vicarious victory leads to more aggressive behaviour on the roads. Large multi-city studies of eating patterns also show ripple effects in response to football games: People in losing cities eat more calories and more junk food in the days following a defeat, perhaps linked to elevated levels of the stress hormone cortisol.

Turning into cavemen?

It's this pattern of primal, involuntary responses that launched Mr. Simons on a personal quest in the wake of a crushing quadruple-overtime loss that eliminated his beloved San Jose Sharks from the 2008 NHL playoffs. The resulting book, The Secret Lives of Sports Fans: The Science of Sports Obsession, was published in April.

"One of the motivators for the book was that I didn't understand why I was so passionate and emotional about this," says Mr. Simons. "It felt very irrational to me, like I was turning back into a caveman."

Over the next three-and-a-half years, he immersed himself in the topic, pestering scientists around the world to explain his obsession, spitting in test tubes while watching the Sharks to learn about his own hormonal responses, and making pilgrimages to hang out with some of the most die-hard fans in the world.

In Cleveland, whose three major league sports teams haven't brought home a championship since 1964, Mr. Simons wrestled with one of the most puzzling aspects of fandom: Why do we stick with teams that apparently offer us nothing but misery and despair?

Story continues below advertisement

The explanation likely starts with our evolutionary need to congregate in groups for safety and competitive advantage against other groups – and to remain loyal to those groups through changing circumstances. "You can't just grow up liking who was good," a Cleveland sports blogger told him. "That's silly."

(Actually, it's eminently rational, and plenty of bandwagon-jumpers do exactly that – but they remain a reviled minority.)

To explain why most fans remain loyal, Mr. Simons points to behavioural psychologist B. F. Skinner's experiments in the 1950s, in which he trained pigeons to lift their head up to a certain height to receive a food reward. If the pigeons were trained to receive the reward every time they raised their heads, and then the reward stopped appearing, they would flap their wings in frustration – and then, after just a couple more attempts, stop raising their heads.

But if the pigeons were rewarded only occasionally and unpredictably during the training process, they would continue lifting their heads another 10,000 times without reward before giving up hope. Is there any reward that's distributed more sparingly and unpredictably than victory for a Leafs fan?

It's not about the athletes

Mr. Skinner, of course, believed that free will is an illusion – that even the most complex human behaviours are simply the sum of our learned responses to external stimuli. That's the picture of the sports fan that emerges when you focus too narrowly on neuroscience: a pitiful marionette whose strings are jerked by atavistic responses to the actions of complete strangers whom he or she will never even meet.

Story continues below advertisement

This view is hardly new. One of the first academic studies of fandom, the 1912 book Social Psychology of the Spectator, pegged cheering for sports teams as "a singular example of mental perversion, an absurd and immoral custom tenaciously held fast in mob-mind." These days, critics like University of Washington evolutionary psychologist David Barash argue that sports are the new opiate of the masses; fans loyal to their teams are "nationalists writ small." The underlying assumption is that these fans are prisoners of their nature, throwing away their time and energy and getting nothing in return.

But the same could be said about our responses to food, music, art and even love – other ways of tickling our brain's reward circuitry that don't inspire the same scorn. And besides, there is a payoff for responding to these urges.

Fandom "provides a buffer from feelings of depression and alienation, and, at the same time, fosters feelings of belonging and self-worth," says Daniel Wann, a psychologist at Murray State University in Kentucky who has been studying fans for more than two decades. This mental payoff is accomplished in part by BIRGing and CORFing – terms introduced in the 1970s by psychologist Robert Cialdini – which allow us to enjoy the vicarious triumph of victory while shrugging off the pain of defeat, albeit imperfectly.

But Dr. Wann's work also suggests that our reflexive responses to sport drive us to engage with our surroundings and with other people, to forge connections and construct identity.

In other words, it's not about the game – or even about the athletes, who may be here today and gone next season thanks to trades or free-agency. "You're actually rooting for the clothes," as the comedian Jerry Seinfeld one pointed out. "You are standing and yelling for your clothes to beat the clothes from another city."

Indeed, sports stars have never seemed less heroic, perhaps thanks to the unfiltered access we get via Twitter. At the same time, social media is making it easier than ever to connect with your extended family of fellow fans – which is how, for example, Mr. Simons encountered the hundreds of supporters of Arsenal, a soccer franchise based in London, England, who gather before dawn at a San Francisco pub for every game, sharing what once would have been the lonely highs and lows of following a team from across the ocean.

Story continues below advertisement

Such realizations have helped Mr. Simons make peace with his seemingly irrational sports obsessions (even if his favourite college football team, the U.C.-Berkeley Bears, is shaping up to have an "awful, really, really, terrible year").

"Oddly enough, as weird as it sounds, I think that being a sports fan is quite rational," he says. "Even with all the stuff it puts you through, we get a lot out of this."

I see his point, if not in the moment then at least with the benefit of hindsight. When Patrice Bergeron scored again in overtime to complete Toronto's collapse in last spring's playoffs, I stormed straight to bed vowing not to read any sports coverage for at least a week. I was disgusted and dejected; so was my dad, with whom I'd been watching the game; so were thousands of other people around the city.

Looking back, I think that's the moment when I realized, after years overseas forming halfhearted attachments to Aussie spin-bowlers and footie teams, that I was really home.

Alex Hutchinson is a Toronto journalist who writes about science and sports. His Jockology column appears biweekly in the Life section.