Originally, for the first 125 years of this country, the only people we elected by popular vote to represent us in the federal government were members of the House of Representatives.  Senators were elected "indirectly" by state legislatures, until the 17th Amendment was ratified, which made them elected by popular vote.  We have never elected our Presidents by popular vote.

James Madison, writing as Publius in the Federalist Papers, wrote extensively about the "#1 Disease" endemic in a republican form of government, which is the tendency for a self-interested majority to trample on the rights of individuals and minorities,  and that history had shown that periodic elections weren't sufficient to guard against this "tyranny of the majority;" extraordinary measures need to be taken to protect against it.  This led to three co-equal branches of government:  Legislative, Executive, and Judicial, only one of which is elected "democratically."  It also led to the division of Congress into