After what seems like years, the Alabama special election is over. The race to replace Attorney General Jeff Sessions in the Senate featured votes spanning nearly four full months, featured one bizarre turn after another, and ended Tuesday night with Democrat Doug Jones pulling off the upset over Roy Moore, who faced allegations that he sexually assaulted teenage girls while he was in his 30s.

Let’s break down the whole thing via winners and losers.

WINNERS

• Democrats’ Senate majority hopes: At the state of the cycle, the math for Democrats winning the Senate majority in 2018 – even in a very good environment – appeared prohibitive. They had only two bona fide pickup opportunities, they needed three pickups, and they had to defend 10 swing and red states that Donald Trump won. The map was just brutal.

But since then, they’ve gotten the news they need to at least put the Senate in-play. Potential takeovers in Arizona and Nevada look increasingly promising.

• The #MeToo movement: As I argued earlier Tuesday, I don’t think the results in Alabama say much about how voters would treat similar allegations in any other state. Alabama is just that uniquely polarized and ruby-red. And the fact that Moore still had a fighting chance – and that so many Alabama Republicans clearly believed him when he said his female accusers were making it up – showed the downside of going public with these things.

But Jones’ win has to be a shot in the arm for the #MeToo movement.

• Democrats’ pulse in the Deep South: To be clear: This is a stunning result – no matter what preceded it. Before Tuesday, a Democrat had not won a U.S. Senate seat in Alabama in more than three decades. The party is practically extinct in the Deep South and have been for a few years now, with their gains there gradually rolling back during the Obama presidency.

I wouldn’t say this ushers in a Democratic revival, by any means – absent the allegations against Moore, Jones very likely would have lost – but the fact that Democrats could even capitalize on the right opportunity in a tough region has to warm the hearts of party officials and supporters.

LOSERS

• President Trump: Trump stuck his neck out by backing Moore even when other members of the Republican establishment wouldn’t, apparently believing Moore had regained momentum and perhaps wary of losing another vote in a closely divided Senate. Whatever the case, it backfired – and in an extremely pro-Trump state, no less.

• Senate Republicans: As The Post’s Paul Kane astutely pointed out Tuesday morning, either result Tuesday was difficult to call a victory for Senate Republicans. Losing the seat would mean their Senate majority was narrowed by half and more imperiled come 2018, but winning it would mean they have to deal with Moore. And even before all the sexual allegations, that was something Senate Republicans really preferred wouldn’t be the case, given Moore’s uniquely extreme politics and penchant for fashioning himself a martyr. Layer on top of that the fact that Republicans said they’d call for an ethics investigation and even, in some cases, Moore’s expulsion, and Moore being in the Senate might be a bigger headache than a Democrat.

In the end, Republicans got Option A.

• Mitch McConnell: This may seem redundant given the above, but there was nobody who took a beating worse in the entire Alabama campaign than the Senate majority leader. Moore decided to make him the bogeyman from the very start, sending hyperbolic emails warning that McConnell was trying to stop him. And when the allegations came to light, McConnell clearly did try to stop Moore, urging him to step aside in favor of a Republican write-in candidate.

Well, none of it worked. And not only did McConnell fail to nudge Moore aside, but by the end of the race, exit polls showed just 16 percent of Alabama voters had a favorable opinion of the Republican leader, versus 67 percent unfavorable – in a red state. Expect plenty of insurgent Republican primary challengers to use this exact same playbook next year. It sure seemed to pay dividends here.