Republic (Res Publica) is a form of government where the government is considered a public matter as opposed to a system where the government is the private concern or owned by a ruler (Res Privata). Typically it is organized in some form of Democracy (usually Representative, but Switzerland has Semi-Direct Democracy (or just direct... they do not have "Pure Democracy") and all 50 states in the United States has some form of Semi-Direct Democracy at the State Level (varies from state to state). Direct Democracy means the ability to participate in the voting on of legislation (achieved in the aforementioned systems by referendums) while Representative Democracies do not (you vote on the person who votes on the legislation).
It's important to know that these terms are used to describe nations whether they meet these things or not. For example, North Korea is officially the "Democratic People's Republic of Korea" but no one participating in this forum is likely to argue that it is any of these things.
To the purposes of your question, the United States is both a Democracy and a Republic, but the general gist of the "The United States is a Republic, not a Democracy" is better stated "The United States is a Representative Democracy, not a Direct-Democracy".
Historically, American politics was found with the idea that government is a necessary evil and served to empower the majority to oppress the minority. Democracy was no different to them than an majority tyranny. Keep in mind, that while King George III was the demon king of the Revolutionary War, it was Parliament, which was creators of the supreme law of the British Empire that was actually oppressing the American colonies through their over representation in the elected government. The solution was Republicanism, where the government was limited in what it could do to the people and these gaps were designed to protect against the tyrant majority. The Founders didn't trust governments... but they also didn't trust mob rule...
Shortly after the American government was set up, two schools of thinking were formed: Jeffersonian Democracy, which held that the lower tiers of government should have more power to govern the people (thus local had more rights of government than state and state had more rights than Federal). Jacksonian Democracy believed that the people should have more say in the government and supported more elective controls to the people (such as judicial elections and eventually state senators). Democracy and being a Democrat was seen as a dirty word around the time of Lincoln.
Licoln's party was called Republicans because they felt that Republicanism was the balance of all participants in government against majority tyranny and tended towards Jeffersonian Democracy. The Democrats were formed from Jacksonian Democracy supporters, who felt that Republicanism as envisioned by Jeffersonian Democracy was a good idea, but as implemented was too restrictive on the common people and that Jacksonian Democracy fixed that problem. Thus they were called the Democratic party because, well, they supported more democratic principles than the Whig party.
The Whig party were efectively split between two factions, the Conscious Whigs and the Cotton Whigs. The former was a strong abolitionsist faction while the later supported softer steps on the slavery issue. The lack of conviction tore the Whigs apart and they effectively died in 1852. Concious Whigs would go on to found various anti-slavery parties that the Republican party emerged from.
The 1860 election saw a three-way split in the Democrats (President James Buchanan was nearly impeached and the reports on the findings were widely distributed, making reelection untenable) between the Northern Steven Douglas supporters, who believed that the states should determine their choice in the slavery issue, the Southern Democrats, backing John Breckenridge, who wanted the federal government to uphold property (i.e. Slavery) ownership rights. Mixed between three, was the Constitution Union party, which wished to preserve the Union above all else: Slavery and Democracy be damned. Naturally, this split gave power to a coalition of abolitionists, which backed Republican Abraham Lincoln, who was able to gather voting blocks of anti-slavery, pro-democracy, and pro-nationalist and the Free Soil party vote.
It is important to note that Jeffersonian Democracy and Jacksonian Democracy are not incompatible, as the former deals with the structuring of government while the later deals with the participation of the voters. The Modern Democrat Party traditionally sees both men as early party leadership.