Thanks to the election and reelection of controversial Republican Gov. Paul LePage with less than a majority of the vote, Maine is trying out a whole new method of voting on Tuesday.

Maine is the first state in the nation to use ranked-choice voting (also known as instant-runoff voting) in a statewide election. It’s largely seen as a rebuttal to LePage, who was elected in 2010 with less than 40 percent of the vote and reelected four years later with less than 50 percent. Besides being known for his obscenity-laced language, the governor has used his power to drag out the implementation of the state’s Medicaid expansion, which passed overwhelmingly on a ballot initiative last year.

Depending on whom you ask, the new method of voting, which allows voters to rank their candidates from favorite to least favorite, is either a push toward a more democratic system or a logistical hellscape.

In ranked voting, if one candidate gets a majority — 50 percent plus 1 — of the vote, they’re declared the winner. But things start to get tricky if no candidate clears the threshold.

That could be especially difficult on Tuesday, when there are a ton of people on the ballot. In the governor’s race alone, there are seven Democrats and four Republicans lining up to replace LePage, who is term-limited. There will also be ranked-choice voting for the nominees running for Congress in Maine’s Second Congressional District, as well as a state House race.

At the very least, we should expect a later voting night than normal in Maine, which typically would have some of the earliest returns on Election Day.

Here’s what you need to know about this historic, chaotic voting system.

How does ranked-choice voting work?

The best way to understand this voting system is by looking at a ranked-choice ballot. Here’s one from the 2011 Portland, Maine, mayor’s election.

As you can see, Portland voters got to fill in the circles noting their first through 15th choices in 2011. Whoever emerges from this system with more than 50 percent of the vote is declared the winner. (It’s worth noting that voters don’t have to rank every single choice on the ballot — they could still just choose one candidate and submit their ballot.)

But if no one gets 50 percent, it becomes a system of gradually culling the lowest vote-getters. Basically, votes are tabulated in multiple rounds. Once the least popular candidates are eliminated, their vote share goes to whichever candidate a voter listed as their second choice.

This vote counting and allocation goes on and on until there are just two candidates left. Whichever candidate has the most votes is the ultimate winner. That Portland mayoral election in 2011 went for 14 runoff rounds to get to a winner with more than 50 percent of the vote ... so, in other words, this can take a long time.

Maine ballots are counted either by hand or by an automated machine, but town and city clerks in Maine have to be extra careful this year. They’re only able to declare the winners who got above 50 percent; if no candidate gets to that threshold, all the ballots get transported to an undisclosed location in the state capital of Augusta, where the tabulating starts.

It’s going to be a lot of work just to collect all the ballots (Maine is a fairly big state with some very far-flung, rural towns) and get them to the capital. So counting everything to determine winners could potentially take days.

Though Maine is the first state to try this method, cities have gradually adopted ranked-choice voting over the years. San Francisco used the method for the mayor’s race this year, and New York City is considering putting the measure on the ballot for its municipal elections.

Ranked-choice advocates say this is simply a more democratic system and less expensive than runoff elections, which have to be held separately and typically have very low turnout (case in point: the Texas runoff).

“We think compared to those other two, it means voters have more say and more reliable outcomes versus plurality,” said Rob Richie, executive director of the nonprofit organization FairVote. “We feel quite comfortable saying it works.”

Tuesday night is the first big experiment to see if that’s true, but Maine voters have also given themselves an escape hatch; the very first question on the ballot on Tuesday is for people to vote on whether they should keep instant-runoff voting or nix the system altogether.

“This is a little bit like Luke Skywalker blowing up the Death Star,” Maine Secretary of State Matt Dunlap told Maine Public Radio’s Steve Mistler. “You get one pass.”

There’s a political fight over instant-runoff voting

There’s one name that comes up again and again when people talk about why Maine is even trying ranked-choice voting: Gov. LePage, who is known for his inflammatory statements, his fights with lawmakers and the press, and his staunch opposition to Medicaid expansion.

Proposals for a ranked-choice system were around before LePage took office, but interest spiked after he was elected and then reelected four years later, according to Maine political science experts. LePage was able to get elected twice without winning the majority of the vote. He won office in 2010 with just 37.6 percent of the votes, and again in 2014 with 48.2 percent of the vote (still beating his opponents for the governor’s seat).

The governor’s tenure has been marked by government gridlock; the state Senate is controlled by Republicans, while the state House is controlled by Democrats. So LePage and Maine Democrats have clashed repeatedly (the governor has also clashed with Republicans), while major bills have been hung up in the process.

LePage is a lightning rod for controversy, but as a term-limited governor, he’s now on his way out. Maine voters seem determined to try out a new system that could potentially prevent another LePage-like candidate from serving in office.

Maine Republicans are very mad about instant-runoff voting, saying it’s unconstitutional for the government to set up an entirely new system of voting. To underscore that point, Republicans in the state Senate tried to sue Secretary of State Dunlap to stop the process from going forward. But their proposal to halt it died on a tie vote in the Senate and was also thrown out by Kennebec Superior Court Judge Michaela Murphy in an April ruling.

So on Tuesday, Maine voters will head to the polls in a controlled experiment. How smoothly it goes could determine whether we’ll see instant-runoff voting pop up in more states around the country.