With all the talk of postponed elections and contested ballots, it's important to know the facts.
Fact #1: The president is not elected by the people. The President is elected by the electoral college.
The President is elected by the electors (in the electoral college) and the electors are appointed by the states. Yes, the electors are chosen on November 3rd, but the electors meet and vote on December 14th. Even if some states are contested, the electors will still meet an elect a President on December 14th.
Whoever gets a majority of the electoral college votes cast on December 14th, wins.
References: Article II, Section 1 of the Constitution and the 12th Amendment.
Fact #2: The House of Representatives picks the President only if nobody gets a majority of the votes from the electors.
The president's term expires at noon on January 20th. If the electors don't meet and elect a new president before then, or if they meet but nobody gets a majority, then the House of Representatives selects the president according to four rules:
Rule 1: The House must pick from a list of people consisting of the top three vote-getters in the electoral college.
Rule 2: The vote is by state, not by Member of Congress, and **each state gets only one vote (for a total of 50 votes)**.
Rule 3: Two-thirds of the states must have members present for the vote.
Rule 4: The vote must occur before March 4th.
Reference: 12th Amendment.
Fact #3: Trump wins a one-vote-per-state election every time.
There are more red states than blue states.
Reference: Map of 2016 election results by state.
Fact #4: The Senate picks the Vice President, and the Vice President can assume the duties of President.
The Vice President is chosen the same way as the President, except that if there isn't a winner in the electoral college then the Senate picks the Vice President from among the top two vote-getters (for VP) in the electoral college, with each Senator getting a vote (for a total of 100 votes).
Reference: 12th Amendment.
Fact #5: If there's neither a President nor a Vice President at noon on January 20th, then the Presidential line of succession applies.
The line of succession applies only when both offices (President and Vice President) are vacant, and it goes: (1) Speaker of the House, (2) President pro tempore of the Senate, (3) Secretary of State, (4) Secretary of the Treasury, (5) Secretary of Defense, (6) Attorney General, (7) Secretary of the Interior, (8) Secretary of Agriculture, (9) Secretary of Commerce, (10) Secretary of Labor, (11) Secretary of Health and Human Services, (12) Secretary of Housing and Urban Development, (13) Secretary of Transportation, (14) Secretary of Energy, (15) Secretary of Education, (16) Secretary of Veterans Affairs, (17) Secretary of Homeland Security.
Reference: 20th Amendment and 3 U.S.C. § 19.
Fact #6 There will be a new Congress on January 3.
The current (116th) Congress adjourns on January 2, and the next Congress (the 117th) convenes on January 3. New Congress means new leadership, including a new Speaker of the House and a new President pro tempore of the Senate. All 435 Members of Congress get elected every two years (for two year terms), and one-third of the Senate gets elected every two years (for six year terms).
If a state doesn't elect new Members of Congress or Senators (because its election is postponed or successfully challenged), then those seats will be vacant when the new Congress picks its leaders and fills any vacancy in the office of President or Vice President.
Reference: 20th Amendment