SEONGNAM, South Korea—Even before a court decides on whether to oust South Korea’s impeached president, the race to succeed her is pitting a former head of the United Nations against an upstart claiming the insurgent mantle of Bernie Sanders.

The looming political upheaval is set to reshape this U.S. ally’s trade relationships and its strategy to deal with volatile neighbor North Korea.

South...