What happens then? Pelosi becomes president?
I think so, yes.
So, here's what happened in 2004:
Alleging widespread "irregularities" on Election Day, a group of Democrats in Congress objected earlier Thursday to the counting of Ohio's 20 electoral votes.
The challenge was defeated 267-31 by the House and 74-1 by the Senate, clearing the way for the joint session to count the votes from the remaining states.
The move was not designed to overturn Bush's re-election, said Ohio Rep. Stephanie Tubbs Jones and California Sen. Barbara Boxer, who filed the objection.
The objecting Democrats, all of whom are House members except Boxer, said they wanted to draw attention to the need for aggressive election reform in the wake of what they said were widespread voter problems.
Thursday's joint session of the House of Representatives and the Senate to count electoral votes is specified in the U.S. Constitution. Cheney, in his role as president of the Senate, presided over the session.
The results from each state, read in alphabetical order, were ticked through quickly until Ohio was called, and a clerk read the objection filed by Boxer and Tubbs Jones.
Then, as required by congressional rules in the event that at least one member of each house objects to the vote, Cheney ordered the lawmakers back to their respective chambers for two hours of debate on the merits of the challenge and to vote on it.
It was only the second such challenge since the current rules for counting electoral votes were established in 1877. The last was in 1969 and concerned a so-called "faithless elector," according to congressional researchers.
Four years ago, after the disputed election results in Florida, members of the Congressional Black Caucus attempted to block Florida's electoral votes from being counted.
In a scene recalled in Michael Moore's movie "Fahrenheit 9/11," lawmaker after lawmaker was gaveled down by Vice President Al Gore because no senator would support the objections, as the rules require.
House Democrats involved in this year's protest worked for weeks to enlist the support of a senator in their party, and Boxer agreed to join the effort Wednesday.
So, the first issue with Trump narrowly losing in 2020 would be the SoS and governors of the swing states. Thankfully, we have the SoS positions in NC, AZ, WI, MI, PA, and AZ, and the governorship in all of those states minus AZ. So even if Trump is up, by say, 5k in Wisconsin, you'd expect that would hold and the recounts would be done with integrity. A Florida2000 like scenario is certainly possible, though very very unlikely. Either way, be glad we won these, especially Wisconsin. Trump probably doesn't have many recourses to challenge the results unless they were exceedingly close, even accounting for a 5-4 GOP majority on the Supreme Court (they only really had the power to do what they were doing because the vote total was in a large pop state with the vote total under 1000 votes where a recount could matter). So those would be most likely be certified.
Your next issue would be faithless electors. This is the biggest fear. It's likely that forcing your electors to vote for a candidate they don't want to could be struck down (this happened in Washington state, I believe), so you'd really have to double/triple/quadruple check when getting your slate of electors. Honestly, the nominees' team should handle this.
So then let's assume that Dems keep the house, GOP keeps the Senate (likely). GOP does not certify the result because it was too close in Wisconsin. So there's no president-elect or vice president-elect. What happens then? According to Wikipedia:
"Section 3 provides that if there is no president-elect on January 20, or the president-elect "fails to qualify", the vice president-elect would become acting president on January 20 until there is a qualified president. The section also provides that if the president-elect dies before noon on January 20, the vice president-elect becomes president. In cases where there is no president-elect or vice president-elect, the amendment also gives the Congress the authority to declare an acting president until such time as there is a president or vice president"
"At this point the Presidential Succession Act of 1947 would apply, with the office of the Presidency going to the speaker of the House of Representatives, followed by the president pro tempore of the Senate and various Cabinet officers. "
So at that point, it would seem the Speaker (Pelosi) would become the president. Complicated but... I think that's right?