The Sunnah is for the imam to be in line with the middle of the row
The Sunnah is for the imam to stand in line with the middle of the row, so the row should start from immediately behind the imam, then be completed to the right and left. It does not matter if there are slightly more people on the right than on the left.
Abu Dawood (681) narrated that Abu Hurayrah (may Allaah be pleased with him) said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “Put the imam in the middle and fill the gaps.”
Al-Manaawi said in Fayd al-Qadeer:
i.e., put him in the middle of the row so that everyone on his right and left can have a share of hearing him and being close to him. End quote.
But this hadeeth is da’eef (weak) and was classed as such by al-Albaani in Da’eef Abi Dawood.
There are other, saheeh, ahaadeeth which clearly indicate the same as this da’eef hadeeth, namely that the imam should stand in line with the middle of the row.
Al-Bukhaari (424) and Muslim (33) narrated from ‘Itbaan ibn Maalik (may Allaah be pleased with him) that the Prophet (peace and blessings of Allaah be upon him) came to him in his house and said: “Where would you like me to pray for you in your house?” He said: I pointed to a place and the Prophet (peace and blessings of Allaah be upon him) said takbeer, and we formed a row behind him and he prayed two rak'ahs.
Al-Bukhaari (380) and Muslim (658) narrated from Anas ibn Maalik that his grandmother Mulaykah invited the Messenger of Allaah (peace and blessings of Allaah be upon him) to come and eat some food that she had prepared for him. He ate some, then he said: “Get up and I will lead you in prayer.” Anas said: The Messenger of Allaah (peace and blessings of Allaah be upon him) stood up, and the orphan and I stood in a row behind him, and the old woman stood behind us, and the Messenger of Allaah (peace and blessings of Allaah be upon him) led us in praying two rak’ahs, then he left.
Muslim (3014) narrated that Jaabir said: I prayed with the Prophet (peace and blessings of Allaah be upon him) and stood on his left. He took me by the hand and made me stand on his right. Then Jabbaar ibn Sakhr came and did wudoo’, then he came and stood on the left of the Messenger of Allaah (peace and blessings of Allaah be upon him). The Messenger of Allaah (peace and blessings of Allaah be upon him) took hold of our hands and made us stand behind him.
The words “we formed a row behind him”, “the orphan and I stood behind him” and ‘he made us stand behind him” indicate that they were directly behind the Prophet (peace and blessings of Allaah be upon him), i.e., the Prophet (peace and blessings of Allaah be upon him) was in line with the middle of the row.
Al-Shawkaani said in al-Sayl al-Jaraar (1/261):
Two or more people should stand behind him in line with him.
In order for them to be in line with him, they should be behind him. If they stand to one side, not in line with him, they would not be behind him. End quote.
Ibn Qudaamah said in al-Mughni (2/27):
It is mustahabb for the imam to stand in line with the middle of the row, because the Prophet (peace and blessings of Allaah be upon him) said: “Put the imam in the middle and fill the gaps.” Narrated by Abu Dawood. End quote.
Al-Nawawi said in al-Majmoo’ (4/192)
Our companions and others are agreed that the first row is recommended and encouraged. There are many ahaadeeth concerning that in al-Saheeh. They are also agreed that it is mustahabb to stand to the right of the imam and to fill the gaps in the rows, and complete the first row, then the next, then the next and so on. No row should be started until the one in front is complete. It is also mustahabb to make the row straight, and no one should let his chest etc stick out from the row to the front or to the rear. It is mustahabb for the imam to stand in the middle and for them to spread to either side. End quote.
It says in al-Mawsoo’ah al-Fiqhiyyah (27/37):
It is proper etiquette to complete the row and fill any gaps, and not to start a row until the one in front is complete, and to make room for one who wants to join the row if there is space. The imam should stand in the middle with the worshippers behind him. End quote.
Shaykh Ibn ‘Uthaymeen said in al-Sharh al-Mumti’ (3/10):
Straightening the rows also means preferring the right side to the left, but that is not to be taken in absolute terms, as is the case with regard to the first row, because if it were in absolute terms as is the case with regard to the first row, the Messenger of Allaah (peace and blessings of Allaah be upon him) would have said, “Complete the rows from the right hand side” but he said: “Complete the first row, then the next.” Since it is not prescribed to start the rows from the right until they are completed, then we should look at the basic principles of sharee’ah to see how this should be done with regard to the left. We find that with regard to the left, if the right and the left are more or less equal, then the right side is given preference, such as if there are five on the left and five on the right, and an eleventh man comes, we would tell him to go to the right, because the right is better than the left when both are equal or almost equal, and there is no obvious difference between the right and the left of the row. But if one side is further away, then there is no doubt that joining the left if it is closer is better than joining the right if it is far away. This is indicated by the fact that if there is a group of three, it is prescribed for the imam to stand between the other two. This indicates that the right is not better in absolute terms, because if it were better in absolute terms, it would be better for both people to be to the right of the imam. But it is prescribed for one to be on the right of the imam and one on his left so that the imam will be in the middle and there will be no imbalance between the two sides. End quote.
Shaykh Ibn Baaz was asked: Should the two begin from the right or from behind the imam? Is it prescribed to achieve balance between the right and left so that it may be said “Make the row equal on both sides” as many imams do?
He replied: The row should start from the middle, from behind the imam. And the right side of each row is better than the left. A new row should not be started until the one in front is completed. There is nothing wrong with there being more people on the right side of a row, and there is no need to make the row equal on both sides, rather the command to do that is contrary to the Sunnah. But people should not form a second row until the first is complete, or form a third row until the second is complete, and so on, because it is proven that the Messenger of Allaah (peace and blessings of Allaah be upon him) enjoined that. End quote.
Majmoo’ Fataawa Ibn Baaz, 12/205.