This question doesn’t have a brief answer. Please click on the detailed answer.
It is mustahabb to pray the wajib prayers (especially the five daily prayers) in jama’ah and in congregation, and this act brings about many rewards. Some Islamic jurists have said: “Praying in jama’ah is better than praying individually on time (at the beginning of the specified time for prayer).”
Of course, as is the case with all other Islamic rulings, this ruling also has certain conditions that must be met, one of them being the correct recitation of the one leading the prayers or the ‘imam’. The great marja’s of taqlid and mujtahids have said: “Whenever one knows that the imam’s prayer is void, for instance if he knows that the imam doesn’t have wudhu, even if the imam himself is unaware, he cannot follow him anymore.” When listing the conditions of the imam, they have said he has to be baligh (come of age religiously), sane, a twelver Shia, adel (pious and just), of legitimate birth and perform the prayer correctly (observing all of its conditions).
In other words, the imam must recite the prayer correctly, and following one who doesn’t meet this condition isn't permissible for others.
Of course, what is essential in recitation is for it to be in accordance with the normal standards of correct recitation, and paying too much attention to the pronunciation of words and recitation in a way that distracts one from the meaning of the prayer is of Shaytan and must be refrained from.
It can be concluded that this ruling (the impermissibility of following an imam with incorrect recitation) only applies when we are sure that the imam’s recitation is incorrect, thus, it is permissible to follow the imam as long as we are not certain that his recitation is incorrect, and merely not being sure isn't enough to make it impermissible to follow him.
In the end, the point should be made that if after the prayer ends one learns that the imam’s prayer was void for whatever reason, it won't affect his/her prayer’s validity in any way.
Islamic jurists have said: “If one following in prayer finds out after prayer that the imam wasn’t just, or was a kafir or that his prayer was void for whatever reason, like not having wudhu, the congregational prayer of the one following will still be correct.”
 Tawdihul-Masa’el of Ayatullah Fazel Lankarani, issue 1417.
 See: Ibid, issue 1434; Tawdihul-Masa’el of Ayatullah Tabrizi, issue 1429.
 Tawdihul-Masa’el of Ayatullah Fazel Lankarani, issue, 1467; Tawdihul-Masa’el of Ayatullah Tabrizi, issue 1462.
 Ajwebatul-Istifta’at (Ayatullah Khamenei), pg. 173, question 599.
 For further information, see: Observing tajwid in prayer, Question 2722 (website: 2979).
 Tawdihul-Masa’el (annoted by Imam Khomeini), vol. 1, pg.776, issue 1421.