A hung Parliament comes about when no single party has a majority of the 650 MPs in the House of Commons after the general election.

But that simple statement barely does justice to the cat's cradle of computations that could follow a deadlocked ballot.

In simple arithmetic, a party needs 326 MPs for a majority in the Commons. But the Speaker, by convention, does not vote and Sinn Fein MPs have traditionally not taken up their seats at Westminster - so that alters the maths straight away.

And it is perfectly possible for a minority government to continue in office on a vote-by-vote basis, without any formal or informal deal with another party or parties, unless and until it loses a vote of confidence in the House.

If no party wins a clear majority on May 6, Gordon Brown will still be Prime Minister on May 7 and Labour ministers will remain in office.

He is the Queen's Prime Minister and they are her government until such time as he advises her to summon another party leader to the palace to take over the reins or asks for another election.

Recently-published Cabinet Office guidance states: "Where an election does not result in a clear majority for a single party, the incumbent government remains in office unless and until the Prime Minister tenders his and the government's resignation to the Monarch.

"An incumbent government is entitled to await the meeting of the new Parliament to see if it can command the confidence of the House of Commons or to resign if it becomes clear that it is unlikely to command that confidence.

"If a government is defeated on a motion of confidence in the House of Commons, a Prime Minister is expected to tender the government's resignation immediately.

"A motion of confidence may be tabled by the opposition, or may be a measure which the government has previously said will be a test of the House's confidence in it. Votes on the Queen's Speech have traditionally been regarded as motions of confidence."

If the government decides it cannot soldier on as a minority administration, it will seek pacts with enough parties to give it an overall majority. That may mean a deal with a large party such as the Liberal Democrats - but, depending on the electoral arithmetic, it could also mean deals with a cluster of smaller nationalist parties or Northern Ireland parties.

The cabinet office guidance makes clear it is the responsibility of the incumbent government to seek these deals and determine whether it can possibly continue in office.

Senior civil servants, led by cabinet secretary Sir Gus O'Donnell, would facilitate the negotiations and their advice is also available to other parties at the discretion of the Prime Minister.

It may, therefore, be open to Tory leader David Cameron and Liberal Democratic leader Nick Clegg to bypass the Premier and do their own deal, if the numbers mean they can achieve a majority together.

If Mr Brown did not resign in the face of such a deal, the opposition parties would force him out through a vote of no confidence in the Commons.

The PM then has a choice: He can simply hand over power, or ask the Queen to dissolve Parliament and call a general election.

But convention makes clear the monarch is not bound to grant dissolution, and could ask others to form an administration. In practice, informal soundings via the Cabinet Office and the Queen's private office would make such a showdown unnecessary.

It would also be open to Mr Brown to resign as Prime Minister but invite the Queen to appoint one of his Cabinet colleagues in his place, if that would mean deals could be done to achieve a majority.

Such pacts can take various forms, ranging from full-blown coalition, with other parties occupying places in government, to informal voting pacts on a "supply and confidence" basis - meaning the opposition party or parties concerned would back an agreed Budget and Queen's Speech and not vote against the government on a vote of confidence.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.