Things are not going swimmingly for the Democrats right now. President Trump was acquitted in his impeachment trial, and he gave a State of the Union address that made Democrats feel like the hapless Japanese military as they watched Godzilla stroll through downtown Tokyo. His polling is up to historic highs, and the economy is roaring.

Meanwhile, the only thing that could have made the Iowa caucuses more disastrous would have been an outbreak of the coronavirus. The Democratic candidate the White House fears the most, Joe Biden, appears to be tanking, and the candidate the White House most wants to run against, Bernie Sanders, appears to be pulling out in front. What’s going on?

I’m persuaded by a theory from professor of political science Seth Masket, author of the forthcoming book “Learning From Loss: The Democrats 2016-2020.” Democrats can’t figure out what to do next because they still haven’t figured out what really went wrong the last time.

Every four years, one of the parties loses the presidential race. As the party pooh-bahs and political pundits play the blame game, a rough consensus quickly emerges about why the party nominee lost.

Sometimes the most self-serving explanation wins out: It was all the candidate’s fault. The election was winnable, and our ideas are great, but our nominee just couldn’t make the sale.

But sometimes the postmortem is coldly empirical and data-driven. We failed to connect with suburban voters. We didn’t turn out our base in Michigan or Ohio. We never came up with a good response to those attacks. And sometimes a consensus emerges that the party itself is ideologically out of touch with a majority of the electorate.

Bill Clinton beat the incumbent president, George H.W. Bush, for a number of reasons, but one of the main ones was that the party recognized that its previous two nominees, Walter Mondale and Michael Dukakis, seemed too beholden to special interests and too committed to liberal orthodoxy.

Clinton ran as a “different kind of Democrat” who went out of his way to shoot some liberal sacred cows.

Hillary Clinton lost the election but not the popular vote. Were it not for some 78,000 votes in five counties — four in Florida and one in Michigan — Clinton would have won the Electoral College tally as well. Such a close election made it harder to understand what went wrong.

In statistical terms, this is white noise well within the margin of error. You can blame the Russians for Trump’s victory, or you can blame the weather, or you can blame Clinton for snubbing the state of Wisconsin. In other words, you can pick whichever theory supports your idea of what the party should do next.

Clinton did not take her defeat well and spent much of 2017 offering self-serving theories about who or what was to blame, from sexist men and self-hating women to voter suppression and fake news to, of course, the Russians. This made a sober accounting of the Democrats’ loss even harder.

And then there’s the Bernie factor. Sanders lost the primaries in 2016, but it’s like he never got the memo. He and his supporters took their surprisingly strong showing to claim a mandate for changes to the party.

There’s also the fact that Trump won despite most polls predicting a Clinton victory. This shock, Masket writes, “undermined many activists’ longstanding beliefs about just what sorts of candidates are electable.”

Add in the fact that the last winning Democratic presidential candidate, Barack Obama, won not by running to the center the way Bill Clinton did but by turbocharging the turnout of the Democratic base, and you can see why many Democrats think that’s a winning strategy this time around. That’s certainly Sanders’ bet. Indeed, for most of the last year, nearly all of the Democratic candidates were fighting in Sanders’ lane and working under the same theory.

But Obama won in 2008 thanks in part to a severe economic crisis and an unpopular war. He was also a compelling candidate. None of that applies today. Actually, the situation is something closer to the reverse.

The Democrats desperately need a candidate who gives moderates and Trump-exhausted Republicans an excuse to oust an incumbent in a time of peace and prosperity. The Trump team understands this, which is why it’s trying to bury Biden and boost Bernie. Unfortunately for the Democrats, they can’t see it.

Twitter: @JonahDispatch