Donald Trump says he’s not going anywhere.

On Saturday, the Republican nominee promised to "never withdraw" from the race despite a political firestorm surrounding a leaked 2005 audiotape that captured him making extremely vulgar comments about women.

But let’s say Trump suddenly does decide he’d rather spend the next month grilling steaks at Mar-a-Lago than hitting the campaign trail in rural Pennsylvania and explaining why it’s okay to say "grab 'em by the pussy" about women.

What happens if he drops out?

In that case, the Republicans have a "break in case of emergency" contingency plan that would force a few hundred party bigwigs into an extraordinary and unprecedented position. They’d decide the fate of the race, with only a few ambiguous rules to help them chart their course forward. (The Democratic Party has a roughly similar arrangement should something happen to Hillary Clinton.)

Nobody’s saying it’s likely to happen. But previously unheard-of things have happened this election cycle — after all, nobody talked about the size of a contender’s genitalia at a presidential debate before either. If the unthinkable did happen, there is a process in place. There’s just little chance it’d be a smooth one.

The party doesn’t decide, and then it does

First things first: Clinton and Trump would have to personally choose to relinquish the nomination to lose it.

Nobody can force them to do so — only the nominees can make the decision to give up their position as their party’s presidential candidate, according to Elaine Kamarck, a senior fellow in governance studies at the Brookings Institution. (Of course, a candidate could also die, forcing the parties onto the same track as if he or she had dropped out.)

But if a candidate did decide to voluntarily step aside, he or she wouldn’t be allowed to pick a replacement. Instead, either party would use a system a little like the Democratic Party’s superdelegates, but on steroids. The members of the parties’ national committees would get together to vote for whomever they want. The candidate with the majority of votes from the national party committees — which consist of 350 people for the DNC and 150 people for the RNC — would then become the presidential nominee.

The national committees could pick pretty much anyone — for instance, Tim Kaine or Joe Biden on the Democratic side, Mitt Romney or Ben Carson for the Republicans. And they could do so at any point up to and including Election Day, even after absentee and early voting has started.

Who is on the committee that would pick a replacement nominee?

Any replacement presidential nominee would have to be chosen by the parties’ national committees. So who makes up the national committees?

This is somewhat confusing. In political journalism we tend to use the terms Democratic National Committee and Republican National Committee to refer to the small leadership groups at the helm of each party. And for good reason: Most of the time, the decisions of the DNC and RNC come down to what the party’s chairs want.

But the DNC and RNC — the ones that would pick any replacement presidential candidate — are actually much larger organizations, with hundreds of members.

The full DNC consists of about 350 officials, according to Kamarck. Two hundred of them are chosen by the state parties, with each state party getting a number of representatives in proportion to its population. (So New York has far more than Rhode Island, for instance.)

The other 150 or so consist of an odd mishmash of party leaders — for instance, all of the chairs of each state’s Democratic Party organization, the head of the national College Democrats, leaders of various unions tied to the Democratic Party, and other party stakeholders. (You can find the full list at the bottom of page three here.)

The RNC is smaller. It consists of 150 officials — three leading Republican officials from each state. In the event that Trump dropped out, the RNC officials from each state would get the same number of votes on the replacement as they had at the 2016 Republican convention in Cleveland, according to the RNC’s "rule number 9." (The RNC rules also say it could simply reconvene the full convention, though that seems logistically unlikely this late.)

If either Trump or Clinton stepped aside, the parties’ chairs would have to call a meeting of the full body of the national committee. We’d then have something like a mini convention — except without any of the pledged delegates that are chosen by the voters through the primary system, and, presumably, far more accusations that American democracy is run by a tiny, elite cabal.

Voters are casting ballots for the Electoral College, not the presidency

Trump and Clinton are already receiving votes, with early voting well underway in several states for a few weeks now. So what happens to those already-cast ballots if the nominees get switched?

What would happen is the party’s new candidate would essentially get the votes cast for the previous one. This is because when voters head to the polls, they’re not actually voting for a presidential candidate. Instead, they’re voting to select the representative that will represent their state at the Electoral College, which in turn meets in December to officially elect the next American president.

"When we go to the polls, we are not actually voting for the presidential candidates. We are voting for electors pledged to that person," Kamarck says.

This is why Clinton or Trump could theoretically still drop out at any point up to and including Election Day itself. It doesn’t even matter, technically, if the candidates’ names don’t appear on the ballots.

As screwy as it might sound, what matters is whose party’s Electoral College representatives end up with more votes. Those state electors are chosen by, and loyal to, the respective parties. It doesn’t matter which nominee the votes were intended for.

But there’s a catch: Some states make Electoral College representatives pledge to support a certain nominee

There is one potential wrinkle in this neat formulation.

Some states have passed laws making their representatives to the Electoral College sign affidavits pledging to vote for a certain nominee. The reason for this is obvious: It’s meant to prevent some rogue elector from ignoring the results of the vote and throwing the presidential election once she’s chosen.

But in the context of this bizarro hypothetical we’re entertaining, that affidavit might incidentally serve another purpose — to prevent the elector from supporting her party’s replacement presidential nominee. So there’s been some speculation that state officials with partisan motives would use the affidavit laws to threaten punishment — or at least litigation — to try to prevent electors from backing their party’s replacement nominees.

Those fears exist but are almost certainly overblown, says Richard Winger, editor of Ballot Access News and an all-around voting guru.

Winger agrees that it is theoretically possible for states to try to enforce the punishments on electors who violate their affidavits. But he says the fines the electors would pay under state law are very minimal — and would probably get picked up by someone else anyway.

Plus, Winger notes, there’s an even bigger defense for an Electoral College representative who supports a replacement nominee: Article II of the Constitution vests the Electoral College with the power of picking the president.

"The electors choose the president — if some state claims it’s going to fine them for ignoring the affidavit, I doubt they’d be able to enforce that," Winger says.

But even before we get there, Winger says, there’s no reason to believe that states wouldn’t be well-equipped to fix their ballots should the truly unexpected come to pass.

"This can be done," he says. "We go to the moon and we explore other planets, and America does a million other amazing things. I think we can reprint ballots."

Watch: Donald Trump's leaked comments about women