Federally, the party holding the majority of seats in the House of Representatives is invited by the Governor-General to form a government. The combined members of that party in the House and the Senate elect one of their number to be Prime Minister, who then recommends to the Governor General those to be appointed to be Ministers.
In the States, similarly the Governor invites the party with the numbers to form a government, and the Premier is similarly elected and recommends ministerial appointments to the Governor.