Rutherford Hayes didn't deny that he had lost the popular vote. Nor was he surprised. His party, the Republicans, had run the country for four presidential terms. The grievances and complaints against them had had plenty of time to accumulate. When government does something good for people, they often are not particularly grateful, reckoning it their due. But when government does something bad, or simply does not do something good, they are quick to point the finger of blame. Voters pointed the finger of blame at the Republicans in 1876, and at Hayes as the Republican standard bearer in the presidential election.
The question, of course, was who would win the electoral vote. If Hayes did, he would be the first person to lose the popular vote and win the electoral vote. (John Quincy Adams had lost the popular vote to Andrew Jackson in a four-way race in 1824, but didn't win the electoral vote, being elevated to the presidency by a vote in the House of Representatives.)
The outcome of the electoral vote mattered to Hayes, naturally. But it mattered no less to the Republicans as a party. In those days before the creation of the civil service, control of the executive branch conferred control of federal hiring. The patronage, as it was called, was the glue that held parties together. Candidates for president did not campaign as they would later, when radio and television allowed them to be heard and seen by millions of people at a time. Instead they relied on proxies, party stalwarts with loud voices who proclaimed the virtues of the nominee. Party organizations in the states and counties mobilized to get out the vote. Devotion to the cause of the party and its platform provided one set of motivations; the prospect of government jobs provided another. If Hayes became president, the Republicans would have another four years at the trough. If the office went to the Democratic nominee, Samuel Tilden, the Democrats would feed and the Republicans would go hungry.
The initial count of electors gave 184 to Tilden and 165 to Hayes. Twenty electoral votes—from the states of South Carolina, Florida and Louisiana—were in dispute. Election required 185 votes. Tilden needed but one of the disputed votes; Hayes needed them all.
With the Constitution providing no guidance for such a situation, Congress created a special commission to adjudicate the matter. Each party insisted on an equal say in the commission, which produced a deadlock. Inauguration day, then in early March, approached with no resolution in sight. No one knew what would happen if the term of incumbent Ulysses Grant ran out with no replacement lined up to succeed him. The Constitution was silent on this too, and the situation had never arisen.
Creative minds in Washington considered how to break the deadlock. The presidency was a prize, but it was not the only thing of value in potential play. Southern Democrats were eager to see an end to Reconstruction. Someone floated the idea of a bargain. The Democrats would agree to reward the contested electors to Hayes, and with them the presidency; and the Republicans, including Hayes, would agree to remove the last remaining federal troops from the South, thus bringing Reconstruction to a definitive end.
Hayes never admitted to agreeing to this bargain. Quite possibly it was never put to him so bluntly. But the Democrats did deliver the electoral vote, and Hayes subsequently agreed to withdraw the federal troops.
Tilden was philosophical about what came to be called the Compromise of 1877. “I can retire to private life with the consciousness that I shall receive from posterity the credit of having been elected to the highest position in the gift of the people,” he said, "without any of the cares and responsibilities of the office.”