All perfect praise be to Allah, The Lord of The Worlds; and may His blessings and peace be upon our Prophet Mohammad and upon all his family and companions.
Muslim jurists have set special terms for following an Imam. Among these is that the person led in prayer should be aware of the Imama`s positions in order to be able to follow him, either by seeing or hearing. This is of course if they are in the same building. If they aren`t, Muslim jurists have two different opinions in this regard:
First: It is invalid for the person led in prayer to follow the Imam, and this is the Mazhab(school of thought) of the majority of the Hanafites, the Shafites and one narration of the Hanbalites. It was stated in "Moghni Al-Mohtaaj": A Shafiee book: "If the Imam and the person led in prayer are in the same mosque, then it is allowed for the latter to follow the Imam. However, if the distance between them is long and there are constructions separating them, then they aren`t considered in the same mosque."
Second: The prayer of the person following the Imam is valid, and this is the Mazhab of the Malikites and one narration of the Hanbalites. Ibn Qodamah said, "Since the person led in prayer was able to follow the Imam, then his prayer is valid even if he couldn't see him, just like the blind man. Seeing the Imam is intended to know in which position the Imam is, and knowing this is possible by hearing his Takbeer, so this is like seeing him."{Al-Moghni 3/45}. And Allah knows best.