Image copyright Getty Images Image caption Moon Jae-in (left) and Ahn Cheol-soo are the main rivals in an election which could see South Korea move to the left

South Koreans will elect a new president on Tuesday, months ahead of schedule, after a corruption scandal that felled conservative President Park Geun-hye.

The poll comes amid major tensions with North Korea, rising youth unemployment and bubbling anger among the electorate over corruption.

Liberal Moon Jae-in, a human rights lawyer, has dominated opinion polls and is the clear front-runner. His closest rivals are Ahn Cheol-soo, a centre-left IT multi-millionaire, and Hong Joon-pyo, the ruling party candidate.

Record numbers cast their ballots in early voting last week and turn-out is expected to be high.

Why are people fired up?

South Korea is still reeling from the money-for-influence scandal that engulfed the former president, who is currently awaiting trial after being impeached.

Huge crowds had protested against Ms Park, amid anger over inequality and the perceived privilege of South Korea's elite. During months of protests older voters came out in support of her, however, exposing a deep generational divide.

Whoever wins the election will have to reunite society and tackle the economic and social mobility issues that have energised the youth vote. Last year, youth unemployment stood at 9.8%, highlighting job-seeking challenges for young people.

North Korea, meanwhile, remains a pressing challenge. Pyongyang has upped the pace of missile tests in recent months and many expect a sixth nuclear test soon. US leader Donald Trump has adopted a hard-line stance and tensions are at their highest level in years.

Image copyright Getty Images/AFP Image caption The next South Korean leader will need to create a workable relationship with both Chinese leader Xi Jinping and Donald Trump.

Who are the main candidates?

Moon Jae-in of the liberal Democratic Party is out in front of his rivals. An aide to former liberal President Roh Moo-hyun, he is trying his chances again after losing to Ms Park in 2012.

A student activist, he was expelled from law school in the 1970s after leading a protest against Ms Park's father, strongman President Park Chung-Hee. After qualifying, he worked as a human rights lawyers for years before entering politics when Mr Roh was elected president.

Domestically, he has talked of tackling the perceived untouchability of South Korea's huge family-run conglomerates and their cosy ties with the government.

On North Korea, he has called for a new vision to achieve peace, one that potentially includes economic engagement - something that critics say channels funds to Pyongyang's nuclear programme.

His position on the US missile system, Thaad, remains unclear, but he was critical of the move to roll it out last month. His spokesman called it "very inappropriate" as it stripped the next government of the right to make its own decision on the system.

Image copyright Getty Images Image caption Early voting took place between 3-5 May - and high numbers turned out

Mr Moon's most prominent rival is Ahn Cheol-soo, a software tycoon and co-founder of the centre-left People's Party.

Nicknamed "Korea's Bill Gates", Mr Ahn has portrayed himself as above the corruption that has plagued the political scene.

He has described himself as a "conservative in security issues and a reformist in economic affairs". On North Korea, he advocates pressure and dialogue to bring Pyongyang to the negotiating table.

He was initially opposed to Thaad but has since said that he will respect an agreement made between countries.

A third candidate who has slowly gained popularity is Hong Joon-pyo, from the conservative Liberty Korea Party. This is the party of the impeached Ms Park, previously known as the Saenuri Party. He says national security is top of his agenda.

Image copyright KCNA Image caption North Korea is threatening to increase its nuclear and ballistic missile capacity

What challenges lie ahead?

Though North Korea dominates dialogue on the international stage, for South Koreans it is domestic issues - jobs, transparency, good governance - where they want the new leadership to make rapid improvements.

According to a survey by RealMeter, 27.5% said the key issue for them was a candidate's willingness to resolve corruption issues, followed by economic and livelihood issues at 24.5% and national security at 18.5%.

But many commentators say the leading candidates have not provided detailed policies.

On North Korea, the incoming president will have to contend with a leader in Pyongyang committed to the development of nuclear weapons, a bullish White House that has suggested military action could be on the table if tensions escalate and an electorate that could be caught in the crossfire.

Initiating a policy of economic engagement could be very challenging amid these circumstances, analysts suggest.

Balancing ties with the US - Seoul's traditional ally - will also be made more complicated by China's furious reaction to the Thaad deployment. Seoul and Washington say the system is aimed at safeguarding against attacks from North Korea, but Beijing says the missile system infringes on its own security and has initiated a number of informal economic sanctions.

Mr Trump, meanwhile, recently suggested South Korea should pay for the system, causing consternation in the host nation. He's also threatened to scrap a "horrible" free-trade deal between the two.

BBC Monitoring reports and analyses news from TV, radio, web and print media around the world. You can follow BBC Monitoring on TwitterandFacebook.