What Is the Imam Responsible for?
Question

Some people told me that the prayer of the one who prays behind an Imam is dependent upon the prayer of the Imam, i.e., so long as the Imam does not make a mistake in his prayer, the prayer of the one who is praying behind him is valid, because it is dependent on it, whether the one who is praying behind him makes a mistake or not. Is this ruling correct, and what is the evidence for that? Does this mean that what invalidates the prayer when it is offered in congregation is different from when one is praying alone?
Praise be to Allah.Duties and responsibilities of the Imam  
In a congregational prayer, the Imam is in front of the people before Allah and is leading them in the most important ritual of Islam, namely the prayer. Hence his prayer is very important and the prayer of those who are praying behind him is connected to it in many rulings, the aims of which are summed up in the Hadith of Abu Hurayrah (may Allah be pleased with him) who said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “The Imam is liable and the Mu’adhin (the one who calls for the prayer) is entrusted. O Allah, guide the Imams and forgive the Mu’adhins.” (Narrated by Abu Dawud, 517; classed as authentic by Al-Albani in Sahih Abu Dawud) 
What does “The Imam is liable” mean?
The words of the Prophet (blessings and peace of Allah be upon him), “The Imam is liable” include many of the meanings of liability or responsibility on which the scholars unanimously agreed with regard to prayer in congregation. 

“The Imam is liable ” means that it is obligatory for him to protect the prayer of those who are praying behind him from becoming invalid and to remember the number of Rak`ahs; he should not peck in the prayer (i.e., move too quickly), which undermines the pillars of the prayer, and he should not fall short in fulfilling the conditions of the prayer; he should make sure that he does the Sunnahs and postures of prayer properly, and so on.
“The Imam is liable” means that he takes on behalf of those who are praying behind him the responsibility of reciting out loud in the prayers where recitation is to be done out loud, and the responsibility of reciting the short Surahs (after Al-Fatihah) too. He also covers the mistake of the one who prays behind him if he omits some of the Sunnahs and even if he omits reciting Al-Fatihah if he comes late to the prayer. All of that is covered in the idea of liability or responsibility, on which there is scholarly consensus.
“The Imam is liable” also means that he is responsible for offering supplication for all those who pray behind him if he says Qunut or offers supplication for them. He is responsible for teaching those who prayed behind him the rulings on prayer so that it will not be spoiled and they will not be deprived of the full reward.

Ash-Shawkani (may Allah have mercy on him) said: 
“’The Imam is liable’ -- liability or responsibility includes the meanings of sponsorship, protection and care. What is meant is that they – i.e., Imams – are liable or responsible when they recite Quran and Adhkar quietly. That was narrated from Ash-Shafi`i in Al-Umm. 
It was said also that what is meant is the responsibility to make sure that his supplication includes all people, not only himself. 
Another opinion said that this liability is because he takes care of standing and reciting for the one who joins the prayer late.” (Nayl Al-Awtar, 2/42) 
Types of mistakes made by those praying behind an Imam 
The scholars did not understand from this Hadith what some people understand, which is that if the Imam’s prayer is valid the prayer of those who are praying behind him is also valid no matter what mistakes they make, and that if the Imam’s prayer becomes invalid, then the prayer of the those who are praying behind him also becomes invalid even if they did all the essential parts and fulfilled all the conditions. 
Rather the scholars say that mistakes that may be made by the one who is praying behind the Imam in his prayer are either of two types: 

The kind of mistake which invalidates the prayer, such as invalidating one’s Wudu, eating, drinking, laughing and other things that invalidate the prayer. That also includes omitting any of the pillars of the prayer. Such mistakes render the prayer of the one who is praying behind the Imam invalid and the Imam cannot cover any of that, according to scholarly consensus.
The kind of mistake that does not invalidate the prayer, such as omitting some Sunnahs or aspects of postures, or making some mistakes such as turning the head, smiling and the like, which does not make the prayer invalid. Or it may include forgetting some obligatory parts of the prayer, such as forgetting to recite the first Tashahhud or the Tasbih when bowing and prostrating, and the like. These are the mistakes that may be covered by the Imam’s prayer, and the reward for praying in congregation may cover shortcomings and mistakes that a person may make.

There are some Fiqhi issues concerning which the jurists of the four Schools of Fiqh differed, according to their differences about the meaning of the words of the Prophet (blessings and peace of Allah be upon him), “The Imam is liable”. These may be seen in the books that discuss differences of scholarly opinion. 
And Allah knows best.