Because of the saying of the Prophet (peace and blessings be upon him): "What releases one from it (the prayer) is the salam." And because of his (blessings and peace be upon him) saying: "Actions are only by intentions."
And (the one giving the salam) should intend greeting those present and the guardian angels, and the follower should, along with that, also intend returning the imam's salam.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / Q2993
It is narrated from Sayyiduna Jabir bin Samurah (may Allah be pleased with him) that when we used to pray behind the Messenger of Allah (peace and blessings be upon him), we would say, gesturing with our hands: 'As-salamu alaykum, as-salamu alaykum' (Peace be upon you, peace be upon you). The Messenger of Allah (peace and blessings be upon him) said: "What is the matter with these people who gesture with their hands like this, as though they were the tails of restive horses? Is it not enough for you that a man places his hand on his thigh and after that gives the salam to his brother on his right and on his left?"
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2993
Samurah (may Allah be pleased with him) related that the Prophet (peace and blessings be upon him) ordered us "to return the imam's salam, to love one another, and to give the salam to one another."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2994
It is narrated from Sayyiduna Samurah (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) ordered us "to give the salam to our imam and to give the salam to one another."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2995
It is narrated from Sayyiduna Samurah bin Jundub (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) commanded us: "When you are in the middle of the prayer or near its end, then begin, before the salam, by saying these words: 'At-tahiyyatu at-tayyibat' (All verbal, financial and physical worship and all sovereignty belong to Allah alone). Then give the salam to your right, and give the salam to your imam and to yourselves as well."
In this hadith is evidence that what is meant by returning the imam's salam is that, when giving the salam to end the prayer, a person also intends returning the imam's salam; a separate salam for it is not necessary.
It was narrated to us by way of Sayyiduna Ibn Umar (may Allah be pleased with them both) that he would say 'As-salamu alaykum' to his right, after that he would return the imam's salam, and if anyone gave him the salam from his left, he would return his salam too.
Al-Zuhri (may Allah have mercy on him) says: Returning the imam's salam is sunnah.
Yahya bin Sa'id (may Allah have mercy on him) used to say: When you give the salam to your right, it will suffice you as a reply to the imam's salam.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2996