In the Hanafi school of thought, it is considered obligatory (wajib) to say Salaam at the end of prayer, first turning to the right and then to the left. If a person deliberately neglects this action, the prayer must be repeated. However, if the Salaam is forgotten unintentionally, no additional action is required to make the prayer valid. The phrase “As-salamu alaykum wa rahmatullah” is said, but it is obligatory to say “As-salam” and optional to add “alaykum wa rahmatullah.” According to some opinions, saying Salaam to the right is wajib, while saying it to the left is sunnah. Regardless, in all schools of thought, prayer is completed with a single Salaam, marking the conclusion of the prayer.
For the Shafi’i school, however, the first Salaam is considered an essential part of the prayer, and its omission invalidates the prayer (Shirbini, Mughni al-Muhtaj, 1/385).