Donald Trump’s victory wasn’t written in the stars. He didn't even win a plurality, much less a majority, of the national popular vote. With relatively small changes in big states – 73,000 votes in Pennsylvania, 27,000 in Wisconsin, 12,000 in Michigan – Hillary Clinton, not Trump, would have been the 45th U.S. president.

When you lose one of the closest presidential elections in U.S. history, as Clinton did Tuesday, many factors align themselves to produce the result. Here are 31, many of them overlapping and reinforcing.

1. Trump Never Held Elective Office. His lack of experience was cited by many people as evidence the Republican nominee was unqualified. For millions of Americans who are disgusted with politics as usual, this was a point in his favor. Even before widespread disdain for Washington set in, the electorate has periodically been enthralled with the idea that an executive from the private sector could show Washington a thing or two. Now the experiment begins.

2. He Wasn’t Really a Republican. Since 1999, Trump had been a registered Democrat, Independent, Reform Party member, and finally, a Republican. Although this offended the GOP establishment, which viewed him as an opportunist, it helped Trump with independent-minded voters contemptuous of the reigning Democrat-Republican duopoly. Former Ohio congressman and Democratic presidential candidate Dennis Kucinich put it this way: “This was a rejection of the Democratic establishment, the Republican establishment, the media establishment, and the financial establishment.”

3. The Mike Pence Pick. Having decided to run as a Republican, however, Trump needed the party’s social conservatives to rally to his side. Choosing Indiana’s governor, a devout Christian who describes himself as an “evangelical Catholic,” bridged the cultural gap between Trump and the party’s religious base.

4. Supreme Court. With one judicial vacancy pending and others likely in the future, one-fifth of the electorate told exit pollsters that the court was a major factor in their vote. Trump won these voters, 57 percent to 40 percent, suggesting that his vow to appoint strict constitutionalists sealed the deal with many conservatives.

5. A “Movement, Not a Campaign.” Trump used that phrase in his victory speech in the wee morning hours Wednesday. What’s happening certainly is bigger than one man. His victory, like the Brexit vote in the U.K., signifies a global revolt of the grassroots against the elites.

6. Re-imagining the Electoral Map. Political experts insisted that it was folly for Trump and his team to believe Michigan and Wisconsin were within their grasp. Pennsylvania was also said to be fool’s gold for Republicans every four years. Trump’s team ignored them—and struck a rich vein across the Rust Belt.

7. Working-Class Whites. “Donald Trump heard a voice no one else heard” is how House Speaker Paul Ryan put it Wednesday. But the alienation of these voters shouldn’t have been a mystery. Between 2007 and 2014, the median incomes of white males without college degrees fell by 14 percent. Trump carried them by nearly 40 points Tuesday.

8. Free Trade. Ross Perot warned of “a giant sucking sound” of jobs leaving the U.S. for Mexico if the North American Free Trade Agreement was passed. Bill Clinton, Al Gore, George H.W. Bush, Ivy League economists, and most of the media scoffed at Perot. But Bernie Sanders didn’t sound much different than Trump on trade on the 2016 campaign trail and Hillary Clinton reversed field on both NAFTA and the pending Trans-Pacific Partnership. In the general election, working-class Americans flocked to a candidate who blamed the Clintons for NAFTA, which Trump repeatedly called “the single worst trade deal ever.”

9. Corporate Greed. In February, a U.S. conglomerate called United Technologies abruptly announced it was closing two Indiana manufacturing plants in its Carrier division and moving them to Mexico. Both factories were profitable, but Carrier can pay workers far less south of the border and import the products at no charge, thanks to NAFTA. United Technologies, which reaps billions from government contracts, recently gave its departing CEO a $184 million severance package. “The greed of United Technologies is unbelievable,” said Sanders. “You really can’t make this stuff up.” Sanders and Trump campaigned hard on that theme, and both won the Indiana primary. Trump carried the state Tuesday by nearly 20 points, only eight years after Barack Obama won it.

10. Trump’s Billions: He’s an unlikely populist champion, this born-to-wealth billionaire who flaunts his riches. But while the media and the Democrats were appalled by Trump’s refusal to release his tax returns, Trump voters focused on something else: His assertion that he was too rich to be bribed.

11. Trump’s Mouth. From the beginning of his campaign – he called Mexican immigrants “rapists” in his announcement speech – Trump’s insensitive comments and racist asides horrified elites, journalists, Democrats, African-Americans, Latinos, Muslims, and others. Trump’s supporters chose to view it another way: They said his lack of a filter showed that Trump was genuine – and has the guts to say what others won’t.

12. Political Correctness. If some voters were rationalizing away his crudeness, the flip side was that he was a walking rebuke to oddball campus speech codes and customs, as evidenced by the Yale professor who excused his students from their midterms in the wake of Trump’s victory. “Nobody votes for Trump or likes Trump on the basis of policy positions,” says alt-right provocateur Milo Yiannopoulos. “That’s a misunderstanding of what the Trump phenomenon is.” Trump is "an icon of irreverent resistance to political correctness.”

13. Hillary’s “Deplorables.” In describing Americans supporting such a brute, Clinton went off-script one day and said that half of them were a “basket of deplorables”– racists, she meant. Clinton backtracked quickly, but “Deplorables” T-shirts were already being proudly worn by aggrieved Trumpers. It was Clinton’s version of Mitt Romney’s “47 percent” remark – the 47 percent of Americans who would vote for Obama because they “are dependent on government, who believe they are victims.”

14. The Real Deplorables. So how much of Trump’s vote was racist (or sexist) or anti-Muslim and anti-immigrant? Measuring prejudice is an imprecise undertaking, but it’s a matter of record that Trump broke into politics by claiming that the first African-American U.S. president was born in Kenya; that Trump obliterated a highly qualified GOP primary field by promising to build a wall between the U.S. and Mexico and proposing a ban on Muslim immigration; and that he was caught on tape (albeit an 11-year-old tape) disparaging women in crude language. Did people vote for him because of this – or despite it?

15. The David Duke Factor. Most Americans probably didn’t know that the ex-Ku Klux Klansman was still active until the mainstream media began parading his endorsement of Trump on the front page. This was supposed to make Trump look bad, but it made the media look like it was actively sabotaging Trump’s campaign—a recurring theme throughout the election season.

16. Crony Capitalism. The grassroots in both parties have come to believe that corporate riches are increasingly dependent on political connections in Washington. Sanders criticized Clinton during the primary season by saying she was too cozy with Wall Street. She confirmed this perception by refusing to release transcripts of her speeches to Wall Street banks.

17. Clinton Cash. When some of those transcripts became available anyway, it looked as though Clinton was saying one thing to the banks in private—banks paying her lavishly for speeches—and something else on the campaign trail. It underscored how she and Bill came to Washington in 1992 with little money, and now have a net worth estimated at $200 million, all while ostensibly in public service.

18. Clinton Foundation. Soliciting massive donations from U.S. billionaires, overseas oligarchs, and foreign governments with lousy human rights records was problematic even before it was revealed that various political hacks were on the foundation payroll, giving the appearance that the Clintons had established a giant slush fund. When the Associated Press—not WikiLeaks—revealed that most of Secretary of State Clinton’s official appointments were with foundation donors, it played into Trump’s “Crooked Hillary” narrative.

19. Benghazi. If Clinton had left the State Department four months before she did, her reputation as the nation’s chief diplomat would never have been mired in the endless rounds of recriminations over an attack that killed four Americans – and whether she was truthful about the nature of the attack and its cause.

20. Her Secret Email System. Just as there are many theories about why Donald Trump won’t release his taxes, speculation abounds about why the Clintons went to great expense to set up a private server in their home. To keep the media from prying into her personal life? (Understandable.) To evade the requirements of federal records act? (Not great, but not a crime.) Or to hide the ongoing coordination between the Clinton Foundation, the State Department, the nascent Clinton presidential campaign and the Clintons’ personal finances? (Pretty sketchy.) Add some sloppiness with classified information and 33,000 emails deep-sixed by Hillary’s lawyers and you get a festering, low-grade scandal that lasted from March of 2015 to the eve of Election Day.

21. James Comey. Even as the election returns trickled in Tuesday night, distraught Democrats pointed fingers at the FBI director—with some justification. After absolving her of criminality over the email server in July, Comey abruptly announced in a letter to Congress that he was reopening the investigation on October 28. The weekend before the election, he made his third announcement—nothing to see here, folks—but by then Clinton’s momentum was stopped by the collective national remembrance of Clinton scandals past, and of impeachment, and well, of a future that seemed unappealing.

22. Anthony Weiner. It was his laptop that led Comey to the abortive second investigation, Anthony Weiner being the “perv,” in New York tabloid-speak, who’s married to Clinton’s top aide, Huma Abedin. (They were wed in a ceremony officiated by Bill Clinton.) The Abedin-Weiner union dissolved for the same reason Weiner resigned his seat in Congress, which was the same reason he lost his attempted comeback in the New York mayoral race: his compulsive “sexting” with strangers. The last one was reportedly a 15-year-old girl, which is why the FBI was rooting through his computers in the first place. Weiner was more than an unwelcome distraction for the Clintons. He was their recurring nightmare.

23. Glass Ceiling. Hillary’s quest to be the nation’s first female president ran into a problem: Women voters didn’t flock to her side as much as the campaign had hoped. Yes, she enjoyed a 54 percent to 42 percent advantage over Trump among female voters, but this “gender gap” was about the same as Barack Obama’s advantage over John McCain and Mitt Romney. Hillary’s candidacy didn’t alter the equation.

24. Passion Gap. Since the first primary back in February, when more New Hampshire voters participated in the crowded Republican primary (won by Trump) than the smaller Democratic field headed by Clinton and Sanders (Sanders won), Democrats have worried about the problem that has dogged them throughout the Age of Obama: Unless Obama is on the ballot himself, Democrats have trouble turning out their voters. This hurt Clinton in all of the Rust Belt states she lost to Trump. The Obama political machine turns out to be non-transferrable.

25. Obamacare. Two weeks before the election, the Obama administration reluctantly conceded that premiums under the Affordable Care Act would rise an average of 22 percent in 2017. A confident Hillary Clinton ignored this bad news, but Trump didn’t. He said Obamacare was “blowing up,” and suggested that the true figure was probably much higher than 22 percent. But Hillary’s husband couldn’t restrain himself. Earlier in October, Bill Clinton complained about the premiums. “The people who are getting killed on this deal are small business people and individuals who make just a little too much money to get any of these subsidies,” he groused. “It’s the craziest thing in the world.”

26. Terrorism. A significant portion of white voters concluded during the last eight years that the Democratic Party in general and President Obama and Hillary Clinton in particular dance around the danger we face. The accusation is that they put a greater value on not hurting anyone’s feelings than on national security. A frequent conservative refrain is that the Democrats won’t even say “Islamic terrorism.” Is this concern justified? Or is it frosting on a cake that should really be labeled “racism” or “Muslim-hatred”? This is not an academic question. Trump’s blunt language helped him become president-elect. Now he, and this country, have to manage emotions he helped unleash.

27. Bruce Springsteen. A loyal Democratic Party trouper every four years, The Boss did his part again in 2016, playing a brief set for a huge crowd at a get-out-the-vote rally in Philadelphia attended by Bill and Hillary Clinton and Barack and Michelle Obama. Springsteen, who’d previously called Trump a “moron,” extolled Hillary’s vision for America while excoriating Trump’s. Playing on his acoustic guitar, Springsteen sang three songs. One number he didn’t play, though, was “My Hometown,” and it is a line from that anthem that has haunted Rust Belt working-class voters for more than a generation: “They’re closing down the textile mill across the railroad tracks,” Bruce sings, “the foreman says these jobs are going boys, and they ain’t coming back.” Except that Trump promised to bring them back, and that’s a siren song of another kind altogether.

28. Kellyanne Conway. Trump’s campaign initially had no professional fundraising outfit, didn’t know enough to launch absentee-ballot campaigns, scoffed at get-out-the-vote efforts, and for much of the year had a single press aide, 27-year-old Hope Hicks. It was an infrastructure that couldn’t have handled the duties of a mayoral campaign. A third staff shakeup brought in Conway, a veteran GOP pollster, as campaign manager, and Breitbart News chief Steve Bannon as the overall head. Trump started heeding the advice of Republican National Committee Chairman Reince Priebus, who had dispatched RNC communications specialist Sean Spicer to New York to babysit the candidate. The pros helped. The Donald remained very much a “citizen politician,” but in the stretch run of the campaign he mostly stayed on message.

29. The GOP Machine. Although Trump didn’t have a get-out-the-vote effort, in some states, notably Ohio and Wisconsin, Priebus and the GOP Senate candidate had robust operations of their own. This helped Trump carry those two states as well as Florida, where Senate candidate Marco Rubio helped drag Trump across the finish line. In other words, even this personality-driven campaign wasn’t a one-man band.

30. Gary Johnson Tanked. The Libertarian Party, in its infinite wisdom, used this year – when millions of Americans were looking for an alternative – to field a candidate who struggled to name a single foreign leader he admired and who seemed like he was, well, stoned, half the time. Johnson is a nice man, but he was a poor fit in the Year of the Angry Voter. That said, he and his running mate, William Weld of Massachusetts, were both former Republican governors who figured to take more votes from Trump than they did. In the end, a critical mass of Americans didn’t want a protest vote, they wanted a protest president.

31. Lesser of Two Evils. In an exhaustive YouGov poll of some 5,000 voters, Clinton held a consistent, if narrow, lead in the national numbers. A large cohort of respondents consistently wouldn’t choose a candidate, however, saying they couldn’t abide either one. When pressed, just as many said they’d vote for Clinton as Trump, but this didn’t quite turn out to be true. A majority of those who told exit pollsters they disliked both candidates ended up picking Trump. Call it the hold-your-nose-and-vote mandate. Could 2016 have ended any other way?