From Wikipedia
http://en.wikipedia.org/wiki/Rutherford_B._HayesHayes became president after the tumultuous, scandal-ridden years of the Grant administration. He had a reputation for honesty dating back to his Civil War years, when as a major general, he refused to campaign for Congress, saying that any officer, who left his command to run for office "ought to be scalped." As Governor of Ohio, his scrupulousness sometimes dismayed even his political allies, and Hayes was nicknamed "Old Granny." Nevertheless, his opponent in the presidential election, Democrat Samuel J. Tilden was the favorite to win the presidential election and, in fact, won the popular vote by about 250,000 votes (with about 8.5 million voters in total).
However, as with all elections, the decision was left to the U.S. Electoral College, where the votes of four states were contested. In order to win, the candidates had to muster 185 votes: Tilden was short just one, with 184 votes, Hayes had 165, with 20 votes representing four states were contested. To make matters worse, three of these states (Florida, Louisiana, and South Carolina) were in the South, which was still under military occupation.
After months of deliberation and bargaining, Southern Democrats were assured that if Hayes were elected, he would pull federal troops out of the south and end Reconstruction. In return, the Democrats agreed to a committee to determine the final outcome of the election. The committee, which consisted of eight Republicans and seven Democrats, voted to give all the disputed electoral votes to Hayes. The Republicans justified this by claiming that the problem in these states was over who had the right to vote. The Democrats, on the other hand, felt that they had been robbed of the presidency, and called Hayes "Rutherfraud."