The policy difference over which Johnson was impeached was the implementation of the 12th, 13th, & 14th Amendments to the Constitution, and trying to end the systemic dehumanization of African Americans.
The Democrats lost to Ulysses S. Grant, who had won the Civil War for the Union.
Hayes lost the popular vote to Tilden, but was given additional electoral votes by the electoral college when he agreed to withdraw federal troops from the South.