عن أبي هريرة رضي الله عنه مرفوعاً: «إنما جُعِلَ الإمام ليِؤُتَمَّ به، فلا تختلفوا عليه، فإذا كبر فكبروا، وإذا ركع فاركعوا، وإذا قال: سمع الله لمن حمده، فقولوا: ربنا ولك الحمد. وإذا سجد فاسجدوا، وإذا صلى جالسا فصلوا جلوسا أجمعون».
The Prophet (may Allah's peace and blessings be upon him) mentioned the wisdom behind appointing an Imām, which is that the worshipers should follow him in their congregational prayer. They should not act differently from him in the actions of the prayer. Rather, the Imām's movements during the prayer should be observed and followed in the same order he does them. Thus, when the Imām says Takbīr, then the congregation should follow him in doing so.
When the Imām bows then they all should follow him, and when the Imām reminds them that Allah will answer the ones who praise Him by saying "Allah hears the one who praises Him", then they should praise Allah by saying: "Our Lord, praise be to You". When the Imām prostrates, Muslims praying behind him should prostrate as well, and if he prays sitting because he is unable to stand, then all of them should pray sitting as well even if they are able to stand.
This is how the Imām should be followed.
Download for free and never miss a prayer again