Ask most Americans how the primaries work, and their answer would be simple: Members of both parties vote for the candidate they like best, and that candidate becomes the party's nominee.

That answer isn't even close to correct. In truth, the primary system is strange, inconsistent, and occasionally rigged. States are sequenced in a confusing (but important!) order, some states allow independents to vote and some don't, some states use bizarre caucus procedures while others hold straightforward primaries, some delegates are bound to follow the popular will while others can do as they please, and then everything can be overturned at the convention anyway.

Typically, none of this much matters because one candidate or another runs away with the election well before the convention and ends up with the most delegates, the most party support, and the highest poll numbers. The win ends up so overwhelming, and is validated by so many different party officials and interest groups, that the outcome feels undeniably legitimate.

But that may not happen this year. Bernie Sanders is gaining in national polls even as he trails badly in delegates and Donald Trump may find himself ending the primaries in first place only to lose the nomination at the convention.

This election, in other words, threatens to expose the gap between how voters think primaries work and how they actually work, and that could tear one or both parties apart.

Why Bernie Sanders is about to have a hard couple of weeks

Of late, Bernie Sanders has taken fire for dismissing Hillary Clinton's delegate lead as a function of her wins in "the Deep South," which he reminds audiences is "a pretty conservative part of this country."

This is neither particularly true nor particularly relevant. Clinton has won in Illinois and Florida, among many other states outside the Deep South, and even if she hadn't, delegates from the Deep South count as much as delegates from anywhere else.

But in a week or two, Sanders might have a new, and more potent, argument. As Ron Brownstein notes, Sanders dominates with independents who vote in Democratic primaries, but of the next six primaries — New York, Connecticut, Delaware, Maryland, Pennsylvania, and Rhode Island — only Rhode Island allows independents to vote in the Democratic race.

Making Sanders's life even harder, some of these states don't allow independents to re-register as Democrats on or near the date of the election, either. In New York, for instance, independents who wanted to vote for Sanders had to make that decision and change their affiliation back in October 2015. So if you're an independent in Buffalo, New York, who was inspired by Sanders's performance in last week's debate, well, too bad. That hurts Sanders's chances, and he knows it.

"I will tell you something that also is of concern to me," Sanders said on CBS. "Even here in New York state, you have a voting system which makes it impossible for independents to participate in the Democratic primary, that makes it impossible for people to register on the day of the election, which many states do, which is going to result in a lower voter turnout than I would like to see."

Closed primaries are not a new thing, and there are good arguments both for and against them (one reason parties force you to register early, for instance, is to make sure voters from the other party don't register en masse in order to cause mischief when they see an opportunity). But because it differs so much state to state, there's no consensus on whether independents should be able to vote in party primaries, and so there's no easy answer for Sanders supporters who don't understand why New York is blocking the kind of turnout seen in New Hampshire.

Wherever you fall on closed primaries, the reality is that the next string of contests is going to leave many of Sanders's voters feeling effectively disenfranchised by party rules; they will view Clinton's wins as the result of a race rigged by the Democratic Party establishment and that will make them less likely to accept her delegate lead as legitimate.

Video: how closed primaries have an impact on voter turnout

Clinton's complaint

Of course, the Clinton campaign has its own complaints. They're offended by Sanders's dismissal of votes from the Deep South, and they note that Sanders doesn't dismiss his own wins in places like Kansas and Alaska, which also don't vote Democratic in presidential elections.

More consequentially, they argue that Sanders's big string of recent wins has come mostly from caucus states, where he tends to far outperform his polling. Caucuses, however, tend to be low-turnout affairs geared toward hardcore supporters, as most voters don't want to give up an entire night with their families so they can argue with strangers — or listen to strangers argue with each other — about which candidate is best. If these were normal elections, Clinton's people argue, her lead would be even larger.

What's worse, from the Clinton camp's point of view, is that the Sanders campaign is promising to try to persuade superdelegates to throw the election to Sanders even if Clinton wins more delegates in the election. This threat is wildly implausible — Clinton is much, much more popular among the Democratic Party officials who dominate the ranks of superdelegates — and probably serves more to keep Sanders's voters from being dispirited by Clinton's delegate lead than anything else.

But to Clinton's supporters, Sanders's recent actions and statements show a blatant disregard for the will of the voters, and prove that he will do absolutely anything to win.

Donald Trump's raw deal

The complaints on the Democratic side, however, pale in comparison with the war brewing on the Republican side, where Republicans are openly threatening to tear the nomination from Donald Trump in a contested convention.

The basic idea here is perfectly legitimate under the rules of political conventions: If Trump doesn't win an outright majority of delegates, then the convention will go to a second vote, and most of the delegates will be free to hand the nomination to someone else. Ted Cruz is already anticipating this outcome, and has been working hard to stock delegate lists with supporters who would happily switch to his side in the event that Trump fails to secure a majority of delegates.

This is an instance of convention rules colliding with democratic norms. Sure, it's legal for delegates to give the nomination to someone who didn't win the most delegates through the primary process, but it's going to look like theft to voters accustomed to seeing the nod go to whoever won the most votes.

"Americans have gotten used to the idea that the person who comes in first in the primaries wins," wrote Vox's Andrew Prokop. "Giving the nomination instead to someone who came in second, or who didn't even run, would look rather unfair — especially to the many enthusiastic Trump supporters out there."

Trump himself has been perfectly clear about how his supporters would react. "I think you'd have riots," he told CNN.

Are primaries fair?

Behind all these disputes lurks a deeper critique of the primaries — one that threatens to tear apart both parties as we head toward the convention. And that critique, put simply, is that the primaries are neither fair nor democratic, and as such their results are illegitimate.

The problems with the primaries begin at, well, the beginning. Iowa and New Hampshire, two of the smallest, whitest states in the union, go first, and whoever wins those states luxuriates in a flood of free media coverage, fresh donations, and undeniable political momentum.

From there, the schedule proceeds according to a logic all its own, but it can disproportionately benefit one candidate or the other by frontloading a regional advantage. That's basically the case Sanders is making about Clinton and the Deep South — he's arguing that the primary schedule puts a slew of southern states early in the process and that's made Clinton's lead look larger and more unassailable than it really is.

Amidst all this, superdelegates roam the land with the power to vote for whichever Democratic candidate they want. In theory, it would be easy for them to mass together and overturn a close primary result. And that's just one of many ways the first-place finisher could lose the nomination at the convention.

Most of these problems tend to be forgotten as the winner consolidates party support. By the time of the convention, the frontrunner's lead is usually so overwhelming, and her competitors so completely crushed, that it's obvious who will end up as the party's nominee.

But that's not happening this year. On the Democratic side, Sanders is mounting a powerful surge at a point when most insurgents fade away. "This far into the race, the candidate who has accumulated the most delegates through the early contests almost always has also led in national polls among voters in their party," writes Brownstein. "But in several recent national public surveys, Sanders has surged to virtually tie, or even slightly surpass, Clinton."

If Sanders's gains continue, he could end up at the convention trailing in delegates but leading in national polls — a situation in which his supporters would have no incentive to consolidate around Clinton.

On the Republican side, Trump's momentum has also slowed, but more to the point, he's loathed by the establishment of the party he seeks to lead. It's possible he'll enter the convention with a plurality, rather than a majority, of pledged delegates, and he'll be facing delegates and party officials who hate him, fear him, and have both the power and the desire to hand the nomination to someone else.

Americans believe their elections are far more democratic than they actually are, and that's because the most undemocratic institutions — like superdelegates and the Electoral College — tend to follow the popular will. But that's because the popular will is usually clear and easy to follow.

This is a year, however, when polls are diverging from delegates, when the public is unusually fractured, and when both the electoral case for consolidation and the desire within the parties to consolidate might be unusually weak.

This is a year, in other words, when voters on both sides will be looking for reasons to doubt the results of their primaries. And they will find plenty of them.

Why aren't all the primaries on the same day?