On the fourth Monday after the election (Nov 18th) Parliament reconvenes. The members are sworn in and the election of the Speaker of the House is held. After the Speaker is sworn into office they put the question to the House “who does the House nominate to form a government for the 43rd Parliament of Canada”?. Any Member may nominate someone but by custom and precedence only those who know that 5% of the full House of Commons (17 of the 338) will endorse their nominee actually stand up to nominate. For a Party that has 17 members or get that number to back them their most senior member is the one to stand up and nominate their Party Leader for Prime Minister.
In this Parliament the most senior members of the Liberal, Conservative, Bloc, and NDP parties stand up and in order of their seniority in the House nominate their respective Party Leaders. All of whom will get the 17 or more members to endorse their Leader as PM. The 4 Leaders go to Rideau Hall the next day where they are formally asked to form a council-designate for consideration to form the government for the 43rd Parliament. Those councils are put to a government formation vote in the House where the Speaker asks the MPs “which of these council-designates have the confidence of this House to be the government of Canada”?
First vote Liberal 158 / Conservative 121 / Bloc 32 / NDP 27. The NDP is removed from the second ballot and the Bloc withdraws from it as well. Last vote Liberals 158 / Conservative 153. Green and NDP abstain and Bloc backs the Tories. And done.
Thursday the Speaker swears in the Bloc and NDP as shadow councils. Saturday the Governor-General at Rideau Hall swears in the Conservative council-designate as the Council of Opposition. Sunday the GG does the same for the Liberals as the Council of Ministers.
And done and works even if the Commons was all independents.