And the next president is…

After opposition parties failed to reach consensus on a joint candidate, the presidential election has come down to a three-man race. Here is all you need to know.

Who is running for president?

It will be a three-man race, after the opposition parties failed to reach a consensus on a candidate for the presidential election.

The ruling-Pakistan Tehreek-e-Insaaf (PTI) has officially nominated Arif Alvi. The Pakistan Peoples Party (PPP) has named Aitzaz Ahsan. 

The third contender, Maulana Fazl ur Rehman, entered the fray after the Pakistan Muslim League-N refused to support Ahsan, who has in the past been a harsh critic of the party. Rehman is the joint candidate of the PML-N, Muttahida Majlis-i-Amal (MMA), Awami National Party (ANP), Pakhtunkhwa Milli Awami Party (PkMAP) and National Party.

How is a president elected?

A president is elected in a special session of the parliament, senate and all four provincial assemblies in accordance with Article 41 (3) of the constitution. The 13th President of Pakistan will be chosen by an electoral college of 706 votes of lawmakers, including 104 senators, 342 members of the national and 260 of the provincial assembly on September 4.

In order to ensure equal representation, all provincial assemblies are given 65 votes each in the electoral college.

Each member of the National Assembly gets one vote as do Senators. 5.70 Punjab parliamentarians makeup 1 vote, 2.58 in Sindh, 1.90 in Khyber Pakhtunkhwa, while MPAs in Balochistan, the smallest assembly, get one vote each. 

Who will win?

Arif Alvi is likely to poll a total of 337.91 votes (excluding the undecided independents in each house). Rehman is expected to receive 199.1, while Ahsan could be picking up 115.44 votes.

The interactive data visualisation below shows expected flow of total and adjusted votes to each candidate by house and party. Click the arrows on the left to move through the slides, or play with nodes and links to analyse the data yourself. Interactive best viewed on a desktop computer.

—Infographic and interactive data visualisation produced by Sajjad Haider