The Book of Leading the Prayer (Al-Imamah)
كتاب الإمامة
Chapter 17: Following those who are following the Imam
(Another chain) from Abu Nadrah (from Abu Sa'eed) with similar narration.
"The Prophet was in front of Abu Bakr and he prayed sitting down, and Abu Bakr was leading the people in prayer, and the people were behind Abu Bakr."
"The Messenger of Allah (ﷺ) led us in Zuhr prayer and Abu Bakr was behind him. When the Messenger of Allah (ﷺ) said the Takbir, Abu Bakr said the Takbir so that the people could hear."
Chapter 18: Where the Imam should stand when there are three, and the discrepancy regarding that
"We entered upon 'Abdullah at midday and he said: 'There will be rulers who would be distracted from praying on time, so pray on time.' Then he stood up and prayed between him and I, and said: 'This is what I saw the Messenger of Allah (ﷺ) do."'
"The Messenger of Allah (ﷺ) and Abu Bakr passed by me and Abu Bakr said to me: '0 Mas'ud, go to Abu Tamim' - meaning the man from whom he had been freed - 'and tell him to give us a camel so that wecould ride, and let him send us some food and a guide to show us the way.' So I went to my former master and told him the same, and he sent with me a camel and vessels of milk, and I brought them via a secret route. Then the time for prayer came and the Messenger of Allah (ﷺ) stood up and prayed, and Abu Bakr stood to his right. I had come to know about Islam and I was with them, so I came and stood behind them. So the Messenger of Allah (ﷺ) pushed Abu Bakr on the chest (to make him move backward) and we stood behind him." Abu 'Abdur-Rahman (An-Nasai)said: (This) Buraidah is not a reliable narrator of Hadith.
Chapter 19: When three men and one woman pray together
"Get up and I will lead you in prayer." Anas said: "So I got up and brought a reed mat of ours that had turned black from long use, and spreaded somewater on it. The Messenger of Allah (ﷺ) stood and the orphan and I stood in a row behind him, and the old woman stood behind us, and he led us in praying two Rak'ahs, then he left."
Chapter 20: When there are two men and two women
"The Messenger of Allah (ﷺ) entered upon us and the only people present were myself, my mother, the orphan and Umm Harh, my maternal aunt. He said: 'Stand up and I will lead you in prayer.' It was not the time for a (prescribed) prayer. And he led us in prayer."
It was narrated from Anas that he and the Messenger of Allah (ﷺ) and his mother, and his maternal aunt (were together). The Messenger of Allah (ﷺ) prayed, and he told Anas to stand on his right and his mother and maternal aunt behind them.
Chapter 21: Where an Imam should stand when there is a boy and a woman with him
"I prayed beside the Prophet (ﷺ) and Ayesha was behind us praying with us, and I was beside the Prophet (ﷺ) praying with him."
"The Messenger of Allah (ﷺ) led me and a woman from my family in prayer. He made me to stand on his right and the woman to stand behind us."
Chapter 22: Where the Imam should stand when the person praying with him is a boy
"I stayed overnight with my maternal aunt Maimunah, and the Messenger of Allah (ﷺ) got up to pray at night. I stood on his left, so he did this to me: He took me by the head and made me stand on his right."
Chapter 23: Who should stand immediately behind Imam and who should stand behind them
"The Messenger of Allah (ﷺ) used to gently pat our shoulders (to make sure the row was straight) at the time of prayer, and he-would say:'Keep (the rows) straight; do not differ from one another lest your hearts would be afflicted with discord. Let those who are mature and wise stand closest to me, then those who are next to them, then those who are next to them."' Abu Mas'ud said: Today, there is much disharmony among you. ,Abu 'Abdur-Rabin (An-Nasai)said: (One of the narrators) Abu Ma'mar's name is 'Abdullah bin Sakhbarah.
"While I was in the Masjid in the first row, a man pulled me from behind and moved me aside, and took my place. By Allah, I could not focus on my prayer, then when he left I saw that it was Ubayy bin Ka'b. He said: '0 boy, may Allah protect you from harm. This is what the Prophet instructed us to do, to stand directly behind him.' Then he (Ubayy) turned to face the Qiblah and said: 'Doomed are Ah1 Al-'Uqd, by the Lord of the Ka'bah! - three times.'Then he said: 'By Allah, I am not sad for them, but I am sad for the people whom they have misled.' I said: '0 Abu Ya'qub, what do you mean by Ah1 Al-'Uqd?' He said: 'The rulers."'
Chapter 24: Setting up rows before the Imam comes out
"The Iqamah for prayer was said, and we stood up and the rows were straightened, before the Messenger of Allah (ﷺ) came out to us. Then the Messenger of Allah (ﷺ) came to us and stood in the place where he prayed, before he said the Takbir he paused and said to us: 'Stay where you are.' So we stayed there, waiting for him, until he came out to us; he had performed Ghusl and his head was dripping with water. Then he said the Takbir and prayed."
Chapter 25: How the Imam should straighten the rows
"The Messenger of Allah (ﷺ) used to straighten the rows like shaft of an arrow is straightened before the head is attached to it. He saw a man whose chest was sticking out from the row. I saw the Messenger of Allah (ﷺ) say: 'Make your rows straight or Allah will cause your faces to be deformed."
"The Messenger of Allah (ﷺ) used to go between the rows from one side to another, patting our shoulders and chests and saying: 'Do not make your rows ragged or your hearts will be filled with enmity toward one another.' And he used to say: 'Allah and His angels send Salah upon the front rows."'
Chapter 26: What the Imam should say regarding straightening the rows when he comes forward
"The Messenger of Allah (ﷺ) used to gently pat our shoulders (to make sure the row was straight) at the time of prayer, and he would say: 'Keep (the rows) straight; do not differ from one another lest your hearts should suffer from discord. Let those who are mature and wise stand closest to me, then those who are next to them, then those who are next to them."'
Chapter 27: Hoe many times should he say "Make your rows straight?"
"Make your rows straight, make your rows straight, make your rows straight. By the One in Whose Hand is my soul! I can see you behind me as I can see you in front of me."
Chapter 28: The Imam encouraging (worshippers) to make the rows solid and stand close to one another
"The Messenger of Allah (ﷺ)turned to face us when he stood up to pray, before he said the Takbir and said: 'Make your rows straight and come close to one another, for I can see you behind my back."'
"Make your rows solid and close together, and keep your necks in line. By the One in Whose Hand is the soul of Muhammad! I can see the shaitan entering through the gaps in the rows as if they are small sheep."