In 2010, the hung parliament led to a coalition being cobbled together in five days by sleep-deprived and underprepared politicians. It looks like we won’t see an outright winner this time round either. So the world of Westminster is frantically scrambling its handful of constitutional minds to work out the various scenarios that could ensue. In the event of a tie, would David Cameron have first dibs? Could the two main parties end up working together? And, the enduring question: what should the Queen do?

When exploring the potential outcomes of a hung parliament, the gap between what technically could happen and what is likely to happen is constitutionally cavernous. Most of this stuff has never been written down. That said, it is no excuse to say the UK is “unaccustomed” to hung parliaments. Of the 20 governments Westminster had in the 20th century, five were coalitions and five were minority governments.

It is a common misconception that the leader of the largest party automatically becomes prime minister. In fact, it is the party leader who can command the “confidence” of the House of Commons. That essentially means securing enough support from the smaller parties. This suggests that Ed Miliband will be at an advantage in a hung parliament, because he has more options for alliances with other parties (see opposite). For example, Labour could form a pact with the Liberal Democrats – who are open to working with either of the main parties – the expanded ranks of SNP MPs and the Greens: both parties that would refuse to prop up a Tory government. The leader of the Democratic Unionist Party in Westminster, Nigel Dodds, has also told the New Statesman that

he “can do business” with Miliband.

This leaves the Lib Dems as the Conservatives’ only credible option. There is also the unlikely prospect of striking a deal with the few Ukippers who make it to Westminster, although the Tory chairman, Grant Shapps, has ruled this out. The DUP could supply David Cameron with some of the support he would need, but is unlikely to help him cross the halfway mark.

The convention is that the current Prime Minister remains in office until the negotiations are over. So Cameron will stay in No 10 – and probably be accused of being a “squatter”, as Gordon Brown was at the last election – until it becomes clear who can lead an administration with the confidence of the House. It also means that Nick Clegg, even if he loses his seat (there are fears he might), will remain Deputy Prime Minister.

This is where the “caretaker convention” comes in. It’s a rule that already applies to civil servants, by way of the more exotically named “purdah”, when the parties are in campaign mode. Purdah is a period when civil servants work with specific restrictions on conducting government business. This convention also applies to ministers during coalition negotiations following a hung parliament. So, although little business can be done – no new policies, contracts or public appointments – Cameron can stay in office, signing off initiatives and stopping ongoing

agreements from lapsing, for as long as it takes for a new government to be formed.

But what would this new government look like? In the absence of a majority, we could see another formal coalition partnership,

like the one we have now. Or a confidence-and-supply arrangement (where a smaller party backs government bills on a case-by-case basis). Or a minority government ruling alone, which is possible, although generally seen as undesirable. We could even see a minority coalition, as New Zealand had from 1999 to 2008. All of these are dependent on the electoral arithmetic, and each of the parties’ red lines when it comes to negotiating a deal. The most intriguing – or terrifying – option is a grand coalition. This would turn Labour and the Tories into allies in government. It’s an option that politicians on both sides have mooted. It is also an example of something that is technically possible but highly improbable. The two old rivals would only unite in the case of a national emergency.

If the electoral arithmetic is irredeemably hung, we could end up with a second election this year. This is a less likely option than it was before, thanks to the Fixed-Term Parliaments Act 2011, which sets the date of elections for the first Thursday in May every five years. Any new government would need support from at least two-thirds of the House for a motion to call an early election, or a successful vote of no confidence. It would be very difficult for a minority government to engineer either of these scenarios.

And what about the Queen? She doesn’t have any say in determining who will form the new government. Her private secretary will be in contact with Downing Street and will keep her updated, but she won’t communicate with the politicians. Although she usually remains in Buckingham Palace immediately after a general election to confirm or appoint the next prime minister, at the last election she discreetly escaped to Windsor for the negotiating period. Which is probably what we should all do, too.