JOHANNESBURG, June 14 (Reuters) - Cyril Ramaphosa was set to be re-elected as South Africa's president on Friday with the support of once rival parties that have agreed to join his African National Congress (ANC) in a new government of national unity.

The ANC - which was forced to share power for the first time in 30 years after losing its majority in last month's vote - still has to work out how to divide up the top cabinet jobs and overcome ideological differences with its new partners.

Here is what to expect next:

WHAT'S HAPPENING NOW?

Just a few hours after the first session of the new parliament got underway on Friday, the white-led, pro-business Democratic Alliance (DA) announced it would co-govern with the ANC "in a spirit of unity and collaboration".

Two smaller parties, the socially conservative Inkatha Freedom Party and the right-wing Patriotic Alliance, are also part of the pact.

The Marxist Economic Freedom Fighters (EFF) party said it will not be part of a government that includes the DA or the Freedom Front Plus - two parties that draw support from the white minority.

The uMkhonto we Sizwe (MK) party, led by former President Jacob Zuma, is also not part of the unity government.

MK, which came in a surprising third in last month's vote, has said it will not partner with the ANC if it is headed by Ramaphosa, a rival of Zuma's who replaced him in 2018. The ANC has said Ramaphosa's position is non-negotiable.

PARLIAMENT CONVENES, ELECTS PRESIDENT

Lawmakers took their oaths of office at the first session of the 400-seat National Assembly since the vote, then elected the ANC's Thoko Didiza as speaker and DA member Annelie Lotriet as deputy speaker.

The voting for president was underway, with Ramaphosa going against EFF leader Julius Malema.

Since the ANC fell short of a majority, Ramaphosa was drawing upon the support of his new political allies to retain the presidency.

Under South African law, candidates for president, speaker and deputy speaker of the National Assembly are nominated by members of parliament. If only one candidate is nominated, he or she is then elected.

In the case of multiple candidates, lawmakers cast secret ballots with a candidate requiring support from a majority of members to be declared the winner.

INAUGURATION OF THE PRESIDENT

The newly elected president is usually sworn in at an inauguration ceremony within days of first session of the National Assembly. He will preside over the seventh administration since the end of apartheid and the advent of multi-racial democracy.

CABINET SELECTION

The negotiations between the parties in the unity government will determine the composition of the executive branch, which is expected to undergo a major overhaul.

Political parties will negotiate conditions, including preferred portfolios, positions and cabinet candidates, which the newly elected president will announce in the days following his inauguration.

Key ministries such as finance, energy, foreign affairs and public enterprises are among the most coveted portfolios.

Prior to the election, Public Enterprises Minister Pravin Gordhan, Minister in the Presidency Nkosazana Dlamini-Zuma and Trade, Industry and Competition Minister Ebrahim Patel all indicated they planned to step down.

South African law dictates that the president, who has the sole discretion to appoint the cabinet and deputy president, may select no more than two people from outside the National Assembly.

Once the cabinet is announced, the president in conjunction with the speaker of the National Assembly and the chairperson of the National Council of Provinces, determines a date for the Opening of Parliament Address.

This address outlines the new administration's governing priorities and marks the beginning of the new five-year parliamentary term. (Reporting by Nqobile Dludla Editing by Joe Bavier, Olivia Kumwenda-Mtambo and Andrew Heavens)