As far as the Republicans were concerned, Jefferson was the only one that could defeat President John Adams, but to do so, Jefferson needed the New York Electors, especially since Pennsylvania's Electors had proven to be unpredictable in 1796. Jefferson and James Madison did the math: New York was the key to winning the Election of 1800, and Aaron Burr was the agent to deliver the state's Electors. Burr succeeded in outmaneuvering his rival, Alexander Hamilton, in New York City, making sure candidates loyal to him prevailed in the 13 NYC Assembly elections. Those men would select the state's 12 Electors, which would vote for Jefferson (Hamilton petitioned Governor Clinton to overturn the results of a fair election . . . he wasn't a very good loser).
Burr's efforts convinced Virginia's 21 Electors that he should be Jefferson's running mate. Virginia was one of the first states to adopt the "Winner-Take-All" strategy for their Electors (only Nebraska and Maine do not do so today), so therefore Jefferson and Burr secured all 42 of Virginia's Electoral Votes (each Elector cast two ballots for President until the 12th Amendment). In order to try and gain as many Electoral votes as possible in Northern states, the Republicans touted Jefferson as the primary author of the Declaration of Independence, which was not widely known until the end of the century. Federalists countered that Jefferson did indeed write the document, but he was not the author, only the "recorder" of the ideas of others in an effort to minimize any Republican advantage.
There was not an Election Day for a popular vote in 1800 (the first such Presidential election that featured a meaningful popular vote occurred in 1824); the Electors voted on 3 December 1800 for President and Vice-President. The states that voted a "Straight Ticket" selected Jefferson with one Electoral vote, and Burr with the other vote. In the states that split their Electoral vote between the two parties, Jefferson and Burr received an equal number (again, each of an Elector's two votes was a vote for President in 1800).
In South Carolina, Thomas Pinckney (Cotesworth Pinckney's cousin, not his famous brother), worked to hand the state's Electors to Jefferson and Burr. It was arranged during this wheeling-and-dealing that one Electoral vote was to be withheld from Burr in South Carolina, thereby avoiding an unnecessary (and embarrassing) tie. However, either the Elector chosen for the "honor" of doing so failed to properly cast his ballot, or the whole endeavor was inadequately organized and communicated. Republican unity proved greater than practical calculations in other states as well as South Carolina, and as a result, Jefferson and Burr each received 73 Electoral votes.
Many Federalists (especially the "High Federalists") were willing to reverse the intended order of the Republicans for President, and tried to elect Burr; these Federalists also entertained the idea of delaying the process until after Inauguration Day. Jefferson thought that a candid conversation with Adams would help resolve the impasse in the House, but Madison (Jefferson's de facto campaign manager in 1796 & 1800) advised him not to do so, in that a conversation with Adams could easily be misconstrued and backfire for the Republicans.
James Bayard, the lone representative from Delaware, could have ended the election in the House on the first ballot, since he was the lone representative from his state. If Bayard had voted for Jefferson on the first ballot, the election in the House would have been over, but Bayard deeply resented the Planter Class, and cast his ballot for Burr. The results of the first ballot in the House were as follows: Jefferson had 8 states, Burr 6, and there were 2 undecided delegations . . . with all 16 states voting, Jefferson needed 9 states in order to become President.
On the 36th ballot, Bayard and members of the South Carolina delegation abstained, and with other movement among the Congressional delegations (Hamilton had convinced other Federalists that Jefferson was the "Lesser Evil" compared to Burr), Jefferson received 10 states to Burr's 4 (and with the two abstentions from DE & SC, all 16 states were on the record). Many of the Republicans believed that Burr was a schemer; to them in appeared that Burr made a play for President, and then failed to make a satisfactory deal with the Federalists (that may well have been true) . . . however, the true instigators of the "Nightmare in the House" were the outgoing Federalists.
Madison was unanimously confirmed as Secretary of State, even though he had never left the shores of America; SecState in the early decades after the Constitution was considered the stepping-stone to the Presidency (Jefferson, Madison, Monroe, John Quincy Adams, and Martin Van Buren all served as SecState before going to the White House).
Soon, John Marshall would be #1 on Jefferson's "Enemies List", replacing Patrick Henry (who died in 1799) and Alexander Hamilton (who was no longer a threat). Marshall was not only a Federalist, but also a popular Virginian, which presented two threats as far as Jefferson was concerned (Marshall and Jefferson were also second cousins). By the time Jefferson was sworn in as President, Marshall had made the transition from being John Adams' last Secretary of State to the 4th Chief Justice of the Supreme Court . . . Marshall would soon show that he was not afraid to flex his legal muscles in interpreting Executive and Legislative decisions in relation to the Constitution as Chief Justice (1801 - 1835), most famously in Marbury v. Madison in 1803.