Shaykh Muhammad ibn Uthaymeen (may Allaah have mercy on him) said in al-Sharh al-Mumti':
When a person prays behind an imam, four scenarios may apply:
1 - Anticipation (doing a movement before the imam)
2 - Delay
3 - Doing an action simultaneously with the imam
4 - Following
1 - Anticipation
This refers to the person doing one of the essential parts of prayer before the imam, such as prostrating or rising before the imam, or bowing or rising from bowing before him. This is haraam, and the evidence for that is the words of the Prophet (peace and blessings of Allaah be upon him): Do not bow until he bows, do not prostrate until he prostrates. The basic principle is that the words do not indicate that the action is haraam, and if someone were to say that it is a major sin, that would not be farfetched, because the Prophet (peace and blessings of Allaah be upon him) said: Does the one who raises his head before the imam not fear that Allaah may turn his head into the head of a donkey, or make his form like that of a donkey? This is a warning, and a warning is one of the signs that a sin is a major sin.
Ruling on the prayer of one who anticipates the imam:
If a person anticipates the imam knowingly, aware of the ruling and of what he is doing, then his prayer is invalid. But if he is ignorant or forgot, then his prayer is valid, unless that excuse ceased to exist before the imam did that action, in which case he has to go back and repeat what he did before the imam, after the imam. If he does not do that, knowing the ruling and aware of what he is doing, then his prayer is invalid, otherwise it is not.
2 - Delay
There are two kinds of delay in following the imam:
(i) Delay for a reason
(ii) Delay without any excuse
The first kind is where there is a reason or excuse. He has to make up what he delayed, then he should follow the imam, and there will be no blame on him, even if it is one or two essential parts of the prayer. So if a person is distracted or loses focus, or did not hear the imam until the imam has done one or two essential parts of the prayer before him, then he should do the things that he delayed in and then follow the imam, unless the imam reaches the point where he is [in the rak'ah], in which case he should not make up the missing parts and he should stay with the imam. Then one rak'ah will be valid for him which is formed from two rak'ahs of the imam, the rak'ah in which he delayed and the rak'ah which the imam reached the same point as him. An example of that is:
A man was praying with the imam and the imam bowed, rose, prostrated, sat up, prostrated a second time and stood up, but the person praying behind him did not hear the loudspeaker except in the second rak'ah, because the electricity cut out for example. Let us assume that this was during Jumu'ah prayer, so he heard the imam reciting al-Faatihah, then the electricity cut out, and the imam completed the first rak'ah, but the person remained standing thinking that the imam had not yet bowed in the first rak'ah, then he heard him reciting Has there come to you the narration of the overwhelming (i.e. the Day of Resurrection)? [al-Ghaashiyah 88:1 - interpretation of the meaning].
We say: you should stay with the imam, so the second rak'ah for the imam will be the rest of the first rak'ah for you. Then when the imam says the tasleem, you should make up the second rak'ah. The scholars said: so the person praying behind the imam will have one rak'ah that is formed from the two rak'ahs of his imam, because followed the imam in part of the first and part of the second.
If he realizes that he has lagged behind before the imam reaches the same point [in the second rak'ah], he should make it up and follow the imam. For example:
A man is standing with the imam, and the imam bows but he does not hear that he is bowing. When the imam says Sami'a Allaahu liman hamidah [Allaah hears those who praise Him - said when rising from bowing], when the person praying behind him hears that, we say to him: Bow and rise, and follow your imam, and you will have caught up with the rak'ah, because the delay here was for a reason.
The second type is delaying with no excuse.
Delaying with regard to an essential part of the prayer means lagging behind in following the imam, but catching up with him in the next essential part of the prayer. For example, the imam bows when you still have a verse or two left of the soorah you are reciting, so you remain standing to complete what you still have to recite, but then you bow and catch up with the imam in rukoo'. In this case the rak'ah is valid, but your action goes against the Sunnah, because what is prescribed is to start bowing when the imam reaches the bowing posture and not to lag behind, because the Prophet (peace and blessings of Allaah be upon him) said: When he bows, then bow.
Lagging behind in an essential part of the prayer means that the imam is one step ahead of you in the prayer, i.e., he bows and rises before you bow. The fuqaha' (may Allaah have mercy on them) said: if you lag behind in rukoo' then your prayer is invalid, just as if you did rukoo' before the imam. If you lag behind in sujood (prostration) then according to what the fuqaha' say your prayer is valid, because it is lagging behind in an essential part of the prayer other than rukoo'.
But the correct view is that if a person lags behind the imam in any essential part of the prayer with no excuse, then his prayer is invalid, whether that is in rukoo' or any other part of the prayer. Based on this, if the imam rises from the first prostration and this person who is praying behind him is making du'aa' in sujood and continues to make du'aa' until the imam prostrates for the second time, then his prayer is invalid, because he has lagged behind in an essential part of the prayer. If the imam is one step ahead of him, how can he then be following him?
3 - Doing an action simultaneously with the imam.
This refers either to word or actions, and falls into two categories:
The first category is say words simultaneously. This does not matter, except in the case of the takbeerat al-ihraam (saying Allaahu akbar to start the prayer) and the salaam (at the end of the prayer).
With regard to the first takbeer, if you say takbeer before the imam has completed his takbeerat al-ihraam, you have not entered prayer in the first place, because it is essential to say the takbeerat al-ihraam after the imam has finished saying it completely.
With regard to the salaam, the scholars said that it is makrooh to say the first and second salaam at the same time as your imam, but if you say the first salaam after he has said the first salaam and the second salaam after he has said the second salaam, there is nothing wrong with this, but it is better not to say the salaam until the imam has said both.
With regard to all other words of the prayer, it does not matter if you say them simultaneously with the imam, or before him, or after him. If we assume that you hear the imam reciting the tashahhud, and you have already recited it, this does not matter, because anticipating the imam in the words of prayer, apart from the first takbeer and the salaam, does not affect the prayer. Similarly it does not matter if you recite al-Faatihah before him and say Wa laa'l-daalleen nor of those who went astray [al-Faatihaah 1:7 - interpretation of the meaning], whilst he is still reciting Iyyaaka na'abudu wa iyyaaka nasta'een You (Alone) we worship, and You (Alone) we ask for help (for each and everything) [al-Faatihaah 1:7 - interpretation of the meaning], in Zuhr prayer, for example, because it is prescribed in Zuhr and Asr prayer for the imam to let the people hear the verse he is reciting sometimes, as the Messenger of Allaah (peace and blessings of Allaah be upon him) used to do.
The second category is to do the actions of prayer simultaneously with the imam, and this is makrooh.
For example, when the imam says Allaahu akbar for rukoo', and starts to bend forward, and you start to bow simultaneously with the imam, this is makrooh, because the Messenger (peace and blessings of Allaah be upon him) said, When he bows, then bow, and do not bow until he bows. And in sujood when he says takbeer for sujood, if you prostrate and reach the floor at the same time as him, this is makrooh, because the Messenger (peace and blessings of Allaah be upon him) disallowed that and said, Do nor prostrate until he prostrates.
4 - Following
Following is the Sunnah, and what it means is that a person starts to do the actions of prayer immediately after the imam starts them, but without doing them at the same time.
For example, when he bows, you bow, even if you have not completed the recitation that is mustahabb [recommended, encouraged], and even if you have a verse still to go, because that would mean that you are lagging behind, so you do not complete it. In sujood, when the imam rises from his prostration, you follow the imam, and your following him is better than your remaining in prostration making du'aa' to Allaah, because your prayer is connected to the imam, and you are now enjoined to follow your imam.
Adapted from al-Sharh al-Mumti', 4/275
The person who is praying behind an imam should not move to the next posture of the prayer until the imam has reached it, so he should not start to go down for prostration, until the imam has placed his forehead on the ground.
Al-Bara' ibn Aazib said: When the Prophet (peace and blessings of Allaah be upon him) said, Sami'a Allaahu liman hamidah', none of us would then bend our backs [to start prostrating] until the Prophet (peace and blessings of Allaah be upon him) went down into prostration, then we would go down into prostration after him. Narrated by al-Bukhaari, 690; Muslim, 474.
Reproduced from Islam QA