Economics.
A brief history:
From 1948 until 1987, both South Korea and North Korea were ruled by, shall we say, less than representative governments. In the South, Syngman Rhee was elected in 1948 and ruled until he rigged the 1960 election, causing riots and protests which forced him in to exile. A year later, Park Chung-hee and his men staged a coup and took over the government, ruling until his assassination in 1979. A month after the assassination, Chun Doo-hwan staged his own coup and ruled the country until 1987. Due to the liberal candidates being unable to agree, they split the vote and Roh Tae-woo, one of Chun Doo-hwan's men, won the 1987 election. It wasn't until 1993 that the first civilian transfer of power between opposition parties took place.
From 1948 until 1987, there were elections in South Korea but they were rife with issues. The 1963 election saw Park win as a civilian against Yun Bo-seon, the man he ousted during the coup. It was a tight election, but Park and his Democratic Republican Party won by about 150,000 votes. In 1967, Park won by a much larger margin, about 1.1 million votes, and in 1971 he won again by about a million votes (against Kim Dae-jung). During these elections, soldiers in the military were told who to vote for and they voted as a group, the government placed restrictions on other political parties, and the field was generally tilted in favor of Park and the military.
The unrest of the 70's and 80's.
South Korea was economically weaker than North Korea until sometime between 1975 and 1985 (depending on sources, measures, and if you believe Soviet/DPRK figures). From the end of WWII until Park took over, South Korea was one of the poorest countries in the world and it's economy was going nowhere. Under those conditions, people didn't care about politics as much as they cared about food and shelter. Under Park, the economy grew at an average of 8% per year (from 1962 until 1989). Korea focused on becoming an export-driven economy, importing raw materials and exporting value-added products (think Hyundai cars, Samsung electronics, Daewoo home appliances, as well as components that we never see - Samsung produces lots of fabric for suits).
By the late 60's, a couple of things happened. First, people were no longer living hand-to-mouth and they began to have disposable incomes; a middle-class began to emerge. This middle class was very loyal to Park and his government because they knew what it was like to be poor and they saw Park as the man who changed that. Second, this new middle class had children who were growing up during the economic miracle, children who would go to college in the 70's and 80's and would demand more freedom.
In the late 60's, the North Korean government began a series of incursions into the south known as the Second Korean War. The Blue House raid of 1968, the capture of the USS Pueblo, and the shootdown of a USAF EC-121 in 1969, coupled with ambushes and raids across the DMZ all contributed to an increase in tension between the North and South, and an increase in paranoia in Park. Shortly after winning re-election in 1971, Park introduced the Yushin Constitution, effectively making him a dictator (even more than he already was). On Liberation Day 1974, an assassin took a shot at Park during a speech but missed, instead killing Park's wife. From that day forward, Park was a changed man.
In the weeks leading up to Park's assassination in 1979, there were student protests breaking out, mainly in Pusan and Masan (the Pu-ma demonstrations). There was a fight between Kim Jae-kyu (head of the Korean CIA and the man who killed Park) and Cha Ji-cheol, Park's personal body guard. Kim urged restraint in handling the protests while Park wanted to crush the student protests with Cha egging him on and denigrating Kim. Finally, October 26, 1979, Kim assassinated Park (and Cha) and ushered in the era of Chun Doo-hwan.
The End
In the spring of 1980, protests erupted in Gwangju, a solidly liberal city in the southwest. Chun sent in paratroopers who killed many civilians in what has become known as the Gwangju Massacre. From that point forward, the Chun government was all downhill, culminating in 1987.
During student protests in 1987, two major events happened: the deaths of Park Jong-chul and Lee Han-yeol, both Yonsei University students.
Park Jong-chul was a 21 year old student who refused to give up the locations of his fellow protesters. The police/KCIA officers tortured him using waterboarding techniques and ended up crushing his throat. He suffocated and died in their custody. During this time, there was a joke that the police had - "We were talking to him and to scare him we hit the table with our hand and he just died!" The fact is that the police routinely tortured people, the children of the new middle class.
Lee Han-yeol was attending a protest on June 9th, 1987 when he was hit in the head with a tear gas grenade. He died a month later on July 5th and his funeral was attended by over 1.5 million people. Be became a symbol for the protests.
On Jun 29th, Roh Tae-woo, Chun's hand picked successor and candidate for the elections gave a speech where he promised to reform the government if elected. He ended up winning the election due to the liberal opposition split and the bombing of KAL 858 a few weeks before the election giving the conservatives a boost.
Why did it all happen
Economics. The people of the 50's and 60's wanted to survive. By the end of the 60's and into the 70's, a solid middle class had emerged and they wanted more freedom. At the same time, the government was becoming more repressive as a way to maintain power and as a reaction to North Korean aggression and the assassination of the president's wife. In the 1980's, the middle-class's children were college students who demanded more political rights and the government overstepped their bounds by torturing the middle class youth, alienating everyone. By 1987, the boiling point had been reached: domestically, the entire middle class was ready to rebel, and internationally, if there was no change, the South Koreans could lose the '88 Olympics, or look horrible while hosting them.
For sources, any entry level Korean History textbook would do.
Bolger, Daniel (1991). Scenes from an Unfinished War: Low intensity conflict in Korea 1966–1969.
Great book for the North Korean aggression and Park's increasing fear of the North/liberals.
Wickham, John (2000). Korea on the Brink: A memoir of political intrigue and military crisis.
A look at the 1979 coup from the commanding general of the USFK/UNC. It covers from the coup until the election of Chun in 1980.