With its first-past-the-post voting principle, a UK General Election does not often result in no party having a working majority of 326 MPs, but when it does, a coalition government is one option. The devolved governments of Scotland and Wales, with their proportional representation systems of voting, thereby regularly produce coalitions. Northern Ireland has a coalition at all times, in accordance with the 1998 power-sharing Good Friday Agreement.
The UK had a coalition government during both World Wars and during The Depression of the 1930s. It came close to having a coalition in the 1970s but the parties could only agree on a pact. The only other national coalition of modern times was in 2010-15 when the Conservatives had 307 MPs and governed with the Liberal Democrats, who had 57 MPs.
There are no set rules on the formation of a coalition, other than that the sitting Prime Minister has the first shot at attempting such a solution. In 2010, negotiating teams were apparently assembled prior to the Election to prepare for what seemed a potential outcome. Common policy points were sought and ministerial roles strategically allocated. However, the Liberal Democrats lost 49 of their seats in the next Election, signifying a large-scale rejection of their effectiveness.
(Image of newly partnered LibDem (L) and Conservative (R) leaders in 2010: Number 10 at Flickr.com / CC BY-NC-ND 2.0)