Unless the new version rules have changed this....
The Junta is those who fired on the palace or moved in the rebel round.
Once the final round of the coup has finished players who control one of the 5 commanding heights (power centres) declare pro president or junta.
If the junta wins the Junta members elect the new president.
in the V3.1 rules, after the 6th Coup round, players have to announce if they support the President or the 1st Rebel, then they check which side wind the Coup.
If Rebels win, only players that become Rebels during the Coup rounds and that chose the 1st Rebel side after that are allowed to vote.
Loyalists that chenged side when having to announce don't take part to the vote.