Since the GOP took over the House five years ago, the chamber has lurched from crisis to crisis. Hardball tactics demanded by conservatives brought the country within days of defaulting on its debt in 2011, and shut down the federal government for 16 days in 2013. Last month, Speaker John Boehner announced his resignation. And now Kevin McCarthy has shockingly dropped out of the race to succeed him.

Overall, the House GOP is a dysfunctional mess — far more than its counterpart in the Senate. And one big reason why is the method by which the House elects its speaker. Most leadership posts in Congress are partisan ones and are determined by party members only, behind closed doors.

Yet the speaker is elected by the House of Representatives as a whole — not just by the majority party. And in practice, the speaker needs to maintain the loyalty of an enormous supermajority of his or her own party — or be at risk of being deposed.

What that means is that the leader of the Senate Republicans needs to keep 28 of his or her 54 members happy. That's pretty easy. The speaker of the House needs to keep 218 out of 247 Republican members happy. That's far, far more difficult.

A Republican House speaker needs a whole lot of Republicans

House Republicans currently have 247 seats in Congress, which is their largest majority in decades. But, assuming all members of Congress are seated and voting, it takes 218 votes to make a speaker. That means that the 30 most extreme Republican members — 12 percent of the conference — can block a speaker from being elected.

By contrast, Mitch McConnell doesn't particularly care what the most extreme 12 percent of the Senate GOP — the six to seven furthest-right senators — think about his leadership. Since only his party votes for Senate majority leader, he only needs the support of 28 out of 54 Republicans to be reelected. It's a cinch.

Now, it's theoretically possible that a group of Democrats could agree to cross party lines and vote for a moderate Republican as speaker. But the two parties are quite polarized — overall, moderate Republicans have a lot more in common with conservatives than they do with moderate Democrats. Accordingly, norms against bipartisan cooperation are incredibly strong. So any Republican who joined in electing such a speaker would be pilloried by the right. And Democrats have little interest in helping out because they want to win back the chamber for themselves — which actually may be easier if Republicans appear tremendously disorganized and incompetent.

There are many 19th-century examples of speaker elections lasting for many rounds of balloting or even months, until some sort of deal is reached. But a failure for a speaker to be elected on the first ballot hasn't happened in nearly a century — since 1923, as Russell Berman wrote at the Atlantic. So we have no recent precedents for what would happen if the majority party's candidate falls short.

How fear of being deposed tied Boehner and McCarthy's hands

It's not yet entirely clear why Kevin McCarthy abruptly dropped out of the speaker's race. But according to one account by ABC News's Jonathan Karl, he simply didn't have those 218 Republican votes. Karl writes:

House Majority Leader Kevin McCarthy made up his mind to pull out of the race to be House speaker this morning after hearing from chamber conservatives that they would directly challenge him on the House floor, sources say. McCarthy’s team determined he only had 175 to 200 House Republicans whom they could count on voting for him, well short of the 218 needed.

Boehner, too, has feared losing power in a coup since he became speaker in 2011 — a fear that has led him, reluctantly, to adopt the approach of governance-by-crisis.

When Boehner first took power, he hoped to simply convince House Republicans that raising the debt ceiling was necessary. "This is going to be probably the first really big adult moment" for the new GOP majority, Boehner told the New Yorker's Peter Boyer in late 2010. "We'll have to find a way to help educate members and help people understand the serious problem that would exist if we didn't do it."

But anti-spending and anti-tax conservatives demanded a more confrontational strategy — one that would use the risk of default on the nation's debt as leverage to force Obama to agree to deep spending cuts. And when Boehner's extremely ambitious No. 2, Eric Cantor, publicly backed the strategy, Boehner felt he had to do the same — or else he'd be too far out of step with his conference's conservatives, and would therefore risk losing his position. Suddenly, then, he became willing to take the country to the brink of default.

Now, there's always been a clear majority of the House of Representatives as a whole that wants the government to be funded and the debt ceiling to be raised. If Boehner simply brought a "clean bill" doing either of those things at any time, it would be highly likely to pass with a combination of mainstream Republican and Democratic votes.

But though Boehner is in theory elected by the whole House, in practice he needs support from that huge supermajority of House Republicans to keep his speakership. (McConnell, in contrast, can much more easily pass measures like this through the Senate.)

So over the past few years, Boehner perfected a sophisticated strategy to deal with conservative demands during the crises like this that kept arising. Until the very last minute, he would look very much like he was trying to do the bidding of the right and fighting hard for their priorities. But in the end, he would always cave and pass something reasonable — funding the government or raising the debt ceiling — with a combination of Republican and Democratic votes. (Earlier this year, I created this game where you can be John Boehner, to explain why he chose this strategy.)

For a while, that worked. But this year, far-right House conservatives have gotten more organized — pooling their votes together in the "Freedom Caucus," which has at least 42 members. In the middle of this year, Rep. Mark Meadows of North Carolina began strategizing to force an effective no-confidence vote on Boehner's speakership. Boehner chose to resign largely because of this threat. He claimed he knew he'd win eventually, but reports suggested that he was short of the 218 votes he needed to win on the first ballot. "I don’t want my members to have to go through this. I certainly don’t want the institution to go through this," he said.

Before Boehner decided to step down, it seemed as if he'd have to try and use his crisis management strategy yet again, this time because of conservatives' demands that any government funding bill defund Planned Parenthood. But once he decided he was on his way out — and therefore no longer had to worry about a coup — he was free to pass a clean government funding bill through the House without worrying what the far right thinks, and did so last month. That's the ultimate indicator that his choices beforehand were restricted by his fear of being deposed.

The House speaker election doesn't make sense for an ideological and partisan era

When the Constitution was written and early American political traditions were established, it wasn't understood that organized parties would quickly come to dominate American politics. Accordingly, the position of speaker of the House was at first created with some expectation that the speaker would represent the institution as a whole, not just partisan interests.

The modern House of Representatives, though, is a partisan body, and its speaker has for decades been the majority party's leader — so it's a bit odd that the speaker is still elected by the House as a whole. However, the Constitution says that "the House of Representatives shall chuse their Speaker," and that's interpreted to mean that all members of the chamber — not just the majority party — have to get a vote.

In practice, this hasn't been much of a problem. The majority party has repeatedly chosen its speaker behind closed doors, in private, with a simple majority vote. The later "official" vote from the full House has just been considered a formality, with that previously designated internal winner getting overwhelming support from his or her own party.

But if a sizable organized faction of the majority party decides instead to abandon its nominee on the House floor — as some conservatives have now threatened — everything can be thrown into chaos. As political scientists Jeffrey Jenkins and Charles Stewart recently wrote, this is "uncharted territory" in modern times. The House GOP has no idea what will come next, and neither do we.