The Constitution didn’t see political parties coming. It says the candidate with the most Electoral College votes is president; the runner-up, vice president.
But in 1796, John Adams wound up with a vice president from the other party. In 1800, Thomas Jefferson and Aaron Burr were running together, but tied in the Electoral College. So the choice went to the House, as the Constitution says. It took 36 ballots to pick Jefferson.
No one wants another deadlock, and parties aren’t going away. Today Congress proposed a new amendment: electors should vote separately for president and vice president.