The election is over, the Coalition has won the most seats. But we don't yet know if it will form a majority or a minority government.

So what happens now?

First, there will be continued counting to determine the outcome of seats in the lower house and the more complex half-Senate election.

When the outcomes have been declared by the Electoral Commission, after re-counts if necessary, the names of the winners will be certified and attached to the election writs which will then be "returned" to the governor-general for House of Representatives seats and the state governor for a state's representatives in the Senate.

The date for the return of the writs is June 28. This will allow the new Senators to commence their terms of office on Monday, July 1.

The Constitution then requires that the Parliament shall be summoned to meet not later than 30 days after the day appointed for the return of the writs.

This means that Parliament will have to sit by the end of July. It is likely to be a short sitting to deal with the formalities.

If anyone wants to challenge the validity of an election, including the disqualification of an elected candidate under section 44 of the Constitution, that has to be commenced within 40 days of the return of the writs on June 28.

How many seats to govern in your own right?

If a party or coalition of parties wins 77 seats in the House of Representatives, it can govern in its own right, because after providing the speaker, this would give it a majority of 76 to 74 on the floor of the House.

If it wins 76 seats, it is trickier. Either it convinces an independent to take up the Speaker's office, or it provides the speaker itself. If it provides the Speaker, then it potentially has a 75-to-75 tie on the floor of the House, unless it is supported by independents, meaning that the Speaker would have to give a casting vote.

This would mean that the government, while technically governing in its own right, would in practice need the support of crossbenchers, especially as conventions govern how the Speaker votes in the case of a tie.

If no party or coalition of parties wins 76 or more seats, then we have a hung parliament.

The incumbent prime minister, Scott Morrison, then has the right to continue on as prime minister until such time as it is clear that he can command the support of a majority of the House of Representatives (for example by securing "confidence and supply" agreements with sufficient crossbenchers to show majority support) or until he faces the parliament and a test of confidence on the floor of the House of Representatives.

If no party or coalition wins 76 or more seats then we have a hung parliament. ( ABC News )

Governments can function for a full term as minority governments, as the Gillard government did.

There is no requirement that there be a formal agreement with crossbenchers to support the government in the passage of "supply" (that is, the passing of the budget and the money bills necessary to run the government) or protect it against the passage of a motion of no confidence, but a minority government would most likely seek to secure such an agreement to provide some stability and security for its future.

Space to play or pause, M to mute, left and right arrows to seek, up and down arrows for volume. Watch Duration: 57 seconds 57 s Gigantic pre-poll centres could cause headaches, says Antony Green

What does the governor-general do?

The Governor-General has no role to play until such time as there is a vacancy in the office of prime minister. He cannot fill an office that is not vacant.

Unless the prime minister resigns, or unless he is dismissed for refusing to resign when there has been a vote of no confidence passed against his government in the House of Representatives, then the Governor-General has nothing to do but sit and watch.

When the Governor-General does act to fill a vacancy, constitutional convention requires that he appoint as prime minister the person who is most likely to command the confidence of the House of Representatives. The governor-general is not bound by the advice of the outgoing Prime Minister about who should be appointed.

Once it is clear who will command the confidence of the House of Representatives, which is likely to be ascertained by vote counting and perhaps agreements with crossbenchers before the parliament sits, only then is it likely that the prime minister will resign and be reappointed if he is the one who commands that confidence, or replaced by whoever else does. The prime minister then advises the governor-general to appoint ministers under section 64 of the Constitution.

In the meantime, government goes on

Until a new government is formed, the existing ministers, including the prime minister, remain in office and continue to fill their ministerial functions.

There must always be a government in place, even when there is uncertainty about who commands the confidence of the lower house.

During this period, the government operates as a "caretaker government" and does not make significant appointments or enter into significant binding contracts.

The caretaker period will not end until it becomes clear who commands the confidence of the lower house and can form a government.

Anne Twomey is professor of Constitutional Law at the University of Sydney. This article originally appeared on The Conversation.