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