Assalamualaikum ustaz. Should a makmum answer the salam given by the imam at the end of the prayer?
Waalaikumussalam wrt. wbt.,
Alhamdulillah, praise and gratitude to Allah SWT for His countless blessings for us all. Praise and salutations to our beloved Prophet Muhammad PBUH, his family, companions, and all those who follow his footsteps until the Final day.
Basically, giving the first salam at the end of prayer is one of the requisites of prayer and if a person didn’t do so, his prayer is invalid. This is explained in a hadith from Ali bin Abi Thalib RA, where the Prophet PBUH said:
فْتَاحُ الصَّلَاةِ الطُّهُورُ، وَتَحْرِيمُهَا التَّكْبِيرُ، وَتَحْلِيلُهَا التَّسْلِيمُ
“The key of prayer is purification; takbir (saying “Allah is most great”) makes (all acts which break prayer) unlawful and taslim (uttering the salutation) makes (all such acts) lawful.” 
Imam Nawawi commented on the above hadith saying: “Giving salam is a requisite among the requisites of prayer. A prayer is invalid without it. Ans nothing can take its place (replace it). At least he must utter the salam phrase (السَّلَامُ عَلَيْكُمْ). And if one of these letters is missing, his salam is invalid.” 
Giving the first salam is included in the requisites of prayer categorized in qauliyyah requisite. It is named qauliyyah for it is conditioned for the person praying to utter the phrase to be heard by himself. 
The simplest of the phrase of salam is (السَّلَامُ عَلَيْكُمْ) once and the best is (السَّلَامُ عَلَيْكُمْ وَرَحْمَةُ اللَّهِ) twice, the first when turning to the right and the second time when one turns to the left. 
This follows the hadith from Sa’d bin Abi Waqqas RA:
كُنْتُ أَرى رَسولَ اللهِ ﷺ يُسَلِّمُ عن يَمِينِهِ، وَعَنْ يَسارِهِ، حتّى أَرى بَياضَ خَدِّهِ.
“I saw the Messenger of Allah (may peace be open him) pronouncing taslim on his right and on his left till I saw the whiteness of his cheek.” 
As for giving salam with the phrase (عَلَيْكُمُ السَّلَامُ), according to madhhab Syafie it is accepted by it is makruh. 
Coming back to the above question, in this issue, there is a hadith from Samurah bin Jundub who said:
أَمَرَنَا رَسُولُ اللَّهِ صلى الله عليه وسلم أَنْ نُسَلِّمَ عَلَى أَنْفُسِنَا وَأَنْ يُسَلِّمَ بَعْضُنَا عَلَى بَعْضٍ
“The Messenger of Allah (ﷺ) commanded us to greet our Imam with Salam, and to greet one another with Salam.” 
In another hadith, Saidina Ali RA narrated regarding the prayer of the Prophet PBUH, he said:
يَفْصِلُ بَيْنَ كُلِّ رَكْعَتَيْنِ بِالتَّسْلِيمِ عَلَى الْمَلاَئِكَةِ الْمُقَرَّبِينَ وَالنَّبِيِّينَ وَالْمُرْسَلِينَ وَمَنْ تَبِعَهُمْ مِنَ الْمُؤْمِنِينَ وَالْمُسْلِمِينَ
“The Prophet PBUH separating between every two Rak’ah with At-Taslim upon the angels that are close (to Allah) and those who follow them among the believers, and the Muslims.” 
According to both the above hadiths, we state that this issue was discussed by scholars. Among them, scholars of madhhab Syafie stated that it is sunnah for a person praying to set an intention to give the first salam for the angels, people and Muslim jinns on his right. And the second salam is for the left. 
For the imam, he can add in his intention of salam for the makmum following him and the makmum can also set the intention to give or answer the salam of the imam or whoever who is together in the congregation prayer. 
We reaffirm that the first salam is a requisite of prayer that is obligatory to be uttered. However, in this question, it is sunnah for the imam to set the intention of salam for the makmum who follows him. Likewise, it is also sunnah to set the intention of salam as giving salam to the imam or answering the salam of the imam or others. However, for those who give salam without setting any intention as stated above, then it is permissible.
 Narrated by Abu Daud (618). This hadith is evaluated as hasan lighairihi by Syeikh Syu’aib al-Arna’uth.
 See al-Majmu’ Syarh al-Muhazzab, 3/475-476
 See al-Taqrirat al-Sadidah, pg. 208
 See al-Fiqh al-Manhaji, 1/141; al-Mu’tamad fi al-Fiqh al-Syafie, 1/300; Mughni al-Muhtaj, 1/385 dan Raudhah al-Talibin, 1/267-268
 See Tuhfah al-Muhtaj, 2/90; Raudhah al-Talibin, 1/267; al-Majmu’ Syarh al-Muhazzab, 3/476 dan al-Azkar li al-Nawawi, pg. 148
 Narrated by Abu Daud (1001)
 Narrated by al-Tirmizi (598)
 See al-Mu’tamad fi al-Fiqh al-Syafie, 1/131
 See Hasyiah al-Baijuri, 1/304