John Quincy Adams became the 6th president simply because he was popular in congress!
It's nice to have friends in high places, especially when you're vying to become the president.
Of course, the American public probably wouldn't agree when electing a new leader comes down to just how many buddies one of the candidates has in the House of Representatives—that's like winning because more people in congress follow you on Twitter.
John Quincy Adams did just that.
The fight between John Quincy Adams and Andrew Jackson was close in the 1824 election. The close call actually split the vote, so neither of them managed to win the majority popular or the electoral vote—thus there was no winner. Protocol stated that they turn their choice to the House of Representatives to choose. Adams had more friends there than Jackson, therefore he earned the different “popular vote.”
It's believed that Speaker of the House Henry Clay managed to convince congress to choose his buddy, who then made Clay Secretary of State. Jackson called this out as a “corrupt bargain.” The feud never subsided.