Like the pollsters, Mayor Rahm Emanuel got it all wrong in predicting that Hillary Clinton would defeat Donald Trump.

On Wednesday, a bleary-eyed Emanuel was kicking himself for failing to see the deep disenchantment that carried the billionaire businessman and reality TV star to the White House.

“Everybody got it wrong, but it was always in front of us. Eyes wide shut,” the mayor said on his way into a City Council meeting. “Everybody saw (Hillary Clinton) winning. But, after the election, the results were also somewhat right in front of you.”

Emanuel then cited Europe, where British citizens’ anger sparked the recent “Brexit” from the European Union and an influx of migrants from war-torn lands has countries on edge.

“If you look at the primary, you look at the way the debate was and you look at what’s going on . . . around the world and in Europe, somewhat you could see this election result.”

At first, the mayor hesitated to return to the political strategist’s role he played for former President Bill Clinton and later, as a North Side congressman who chaired the Democratic Congressional Campaign Committee and engineered the 2006 Democratic takeover of the Illinois House.

But, after a question or two, he couldn’t resist the temptation to analyze the Trump shocker.

“There’s issues of economic anxiety. There’s issues as it relates to cultural and racial anxiety. And there’s issues of what you think the future brings and the respect people have for that diversity,” Emanuel said. “When I include diversity, I also mean people that don’t represent different immigrant groups but represent third, fourth fifth generation of people that came to America. We have to respect all of that diversity.”

Emanuel also opined on the psyche of Trump voters who were willing to overlook all of the controversial and impetuous statements made by the candidate — about women, immigrants and people with disabilities — because they believed that Trump represented the dramatic change they were seeking.

“I don’t think it was fear of government,” the mayor said. “If you look at the results of this election, it’s in many ways a statement to all elites: media elites, public elected officials and financial/business elites: ‘You can no longer ignore us and disrespect us.’ . . . There is a sense that their struggles are not heard.”

Nationally, those voters spoke with a shout, particularly in Rust Belt states that have mostly favored Democrats in recent elections. Nationwide, polls showed some 67 percent of working-class voters backed Trump.

Trump’s strong support among those with less than a college education is at least partly a reflection of how little the economic recovery since the Great Recession has benefited them. Their job opportunities have dwindled and their incomes have fallen, even as broader measures of the nation’s job market show improvement.

The white vote has shrunk in recent years — from about 80 percent in 1996 to 70 percent of Tuesday’s vote — but that’s still a powerful number. Trump dominated with whites no matter how you dice their votes — among men and women, young and old, college-educated and noncollege-educated. That diluted the potency of Clinton’s strong performance with Hispanics and blacks.

In North Carolina, where Trump won by a 4-point margin, the race was decided less on Clinton’s failure than on Trump’s unanticipated success. Clinton’s campaign had hoped African Americans would make up 20 percent of the electorate, and they did. Nine in 10 blacks supported the Democrat. But Trump’s strength with white, rural and small-town voters overwhelmed her support among blacks.

Likewise, in Florida, where Trump won by just over 1 percentage point, Hispanics favored Clinton by almost a 2-to-1 margin and nearly 9 in 10 blacks backed her. But their outsized support for her was swamped by Trump’s 2-to-1 lead among whites, who made up more than 60 percent of the electorate.

Clinton carried Illinois, but couldn’t match that success in other Midwestern states, including Michigan and Wisconsin, both of which backed Barack Obama in 2012.

Emanuel urged shell-shocked Chicagoans who “went to bed despondent” not to overreact to Donald Trump’s stunning upset.

The mayor pointed to the silver lining victories by a rainbow coalition of Democrats: Tammy Duckworth for the U.S. Senate; City Clerk Susana Mendoza in the race for state comptroller: Raja Krishnamoorthi in the 8th Congressional District and Kim Foxx for state’s attorney.

According to the mayor, all of those victories show that the diverse and tolerant America that served as a magnet for his immigrant grandfather and for the dozens of new Americans to whom Emanuel administered the citizenship oath on election day is alive and well and will remain so, even under President Donald Trump.

“A lot of people in Chicago woke up despondent, went to sleep that way wondering whether this country still has them, their future and their children’s future at heart,” the mayor told aldermen from the rostrum at a City Council meeting.

Later, the mayor acknowledged the deep-seated anxieties of the children of immigrants known as “Dreamers” for the Dream Act that granted them asylum.

He talked about the City Colleges Star Scholarship, mentoring and after-school program that benefit immigrant students. He also touted the $1 million he is putting into the creation of a municipal ID so those on a path to citizenship have the “benefits to participate” instead of living “in the shadows.”

“To those families, you are welcomed here in the city of Chicago. Your dreams for your children count. Your struggles to give your children a chance at the American dream are heard in this city,” the mayor said.

“I would say to DAKA, to Dreamers, to those that live on the periphery: One, do not lose hope because America embraces you. Two, the city of Chicago at many, many different levels [welcomes you]. … I know your sense of fear. I would tell you there’s more hope in embracing a view than you are fearful [of] at this very moment, post an election.”

Although Emanuel treasures his friendship with the Clinton’s, the mayor and Hillary Clinton have had their differences over the years.

As a brash young staffer to former President Bill Clinton, Emanuel was demoted and nearly fired at the behest of then-first lady Hillary Clinton. The mayor has even joked that he was fired, but refused to leave.

As Obama’s chief of staff, Emanuel reportedly delivered the news to then-Secretary of State Hillary Clinton that she could not put longtime political confidante Sidney Blumenthal on the State Department payroll.

During the 2016 presidential campaign, Clinton has steered clear of Emanuel for the better part of a year — ever since the political furor over the mayor’s handling of the Laquan McDonald shooting video triggered months of protests and demands for the mayor’s resignation.

Clinton joined Illinois Attorney General Lisa Madigan’s call for a federal civil rights investigation of the Chicago Police Department that Emanuel initially called “misguided” before embracing it.

During the primary, Democratic challenger Bernie Sanders pummeled Emanuel as a Wall Street puppet who closed a record 50 public schools and kept the McDonald shooting video under wraps for more than a year.

Back in March, a Clinton ally urged her campaign chairman John Podesta to have the Democratic presidential candidate “separate big time” from Emanuel, according to an email released last month by WikiLeaks.

Emanuel was still taking it on the chin at the Democratic National Convention in Philadelphia where Clinton claimed her historic nomination.

A ten-minute video that highlighted Obama’s achievements essentially threw the mayor under the bus by portraying Emanuel as a calculating naysayer whose advice was ignored during the fight for Obamacare.

It wasn’t until earlier this month that Emanuel finally resurfaced on the campaign trail. He was given a speaking role at a get-out-the-vote rally across from Trump Tower featuring the Democrats’ “Forward Together” tour bus.