The Civil War was at its roots a clash of cultures. The North was an industrialized sophisticated society while the South was an agrarian nearly feudal society. Psychologically they were completely at odds with each other.
Politically the war was fought over the issue of "States Rights." Since the signing of the Constitution the question of state versus federal power was at issue. States considered themselves sovereign, united into a federal government. They believed states had the power to nullify federal laws and supported a weak federal government. Reluctant to cede power to the states, the Federal Government rejected this argument, a power keg sat waiting for a spark to set off an explosion.
The election of Abraham Lincoln to the presidency in 1860 was the spark that ignited the explosion that was to be the Civil War. The newly formed Republican party opposed the expansion of slavery into the western territories. That would have driven a stake through the power of the South. It received a disproportionate power in Congress because the Constitution counted slaves as 3/5th of a free man. Although slaves couldn't vote, they counted in the apportionment of the House of Representatives. Without the ability to expand slavery westward, Southern politicians realized they would lose power as the country expanded. They couldn't abide that. Rather than lose power they chose secession and formed their own nation. Lincoln waited until the South made the first move. Their attack on Fort Sumter started a war the South couldn't win.
Emancipation of slaves was secondary to the preservation of the union; however, the continuation of Southern slavery was the issue behind the South's refusal to compromise. Lincoln and the Republican Party would have allowed the South to keep the institution where it existed, but refused to allow more slave states. The war and The Emancipation Proclamation were the death knells of slavery.
Confederate General Robert E. Lee's surrender at Appomattox Court House effectively ended the conflict and settled the issue of states right of secession.
During the war, the Republican Party was split over what to do after the South was forced back into the Union. Lincoln was the leader of the moderates. His Assassination April 14, 1865 gave the Radical Republicans the power to impose some harsh conditions on the crushed South. Federal troops occupied the defeated states and a harsh period of reconstruction brought more than a century of Southern hatred for "those damn Yankees." A political deal gave the election of 1876 to Republican Rutherford B. Hayes and ended reconstruction. It assured control of the South by the Democratic Party until Brown vs. Board of Education desegregated Southern schools, Leading to the Civil Rights legislation of the 1960's.
The Civil War ended two issues that had bedeviled the country since the adoption of the Constitution. It affirmed the primacy of the Federal Government and ended the debate over slavery.