|When he went there and said Assalamu Alaikum, they said Va'alaikumussalam in return (Bukhari and Muslim).
The holy Qur'an has quoted Salam of Ibrahim (A) and angles when they went to Ibrahim (A) (51:24, 25).
The perfect form of Salam is Assalamu Alaikum Varahmathullahi Vabarakathu. Greeting of Salaam is a voluntary action, but returning it is obligatory. It is better to greet salaam by those who go in vehicles to walkers, walkers to those who stand and small group to big group, but changing of this order is not disliked, but it is not good and will loss the reward of the order.
Greeting and returning of salam by a strange (non-mahram) woman to a strange man and a strange man to a strange woman are haram (prohibited). It is recommended for a woman to greet Salaam to her husband and Mahram men. There is no problem to greet Salam by a man to an unattractive old woman; but Sunnah. There is no prohibition in greeting and returning of Salam by a man to a group of women (two or more).
If a group of people were greeted by Salam, then it is better to return it by each of them. But their responsibility will end with one's response. If a group of people greet Salam one by one or together to a single man, then he is responsible to return once only. If a deaf man greets Salam it should be returned by word and gesture also.
Though greeting of Salam is Sunnah and returning is obligatory, more reward will be given to those who greet than those who return. It is better to use the plural form “Alaikum" though the Salam is greeted to a single man or by a single man. This is by considering the honour of the believer and the presence of angles with him. The following statement of Ibnu Arabi is notable “If you say (in the prayer) Assalamu Alaina Va'ala Ibadillahi Sswaliheen or Assalamu Alaikum to a person in the way, then you intend all the righteous persons in the earth and sky whether dead or live. Then the angles and the spirit, to whom your Salam reaches, will reply to your Salam. That is an answer expecting prayer which will cause for your success.
It is not recommended to greet salaam to those who indulge in evacuating the bowels or urine, or clean these two, or indulge in sexual intercourse, eat or drink (when there is water or food in mouth), or they are miscreants or Mubthadis (the deviators), who are in the prayer or in prostration of thanks or recitation of holy Qur'an, or one calling Adhan or Iqamah, or performing Jumu'a Khuthuba and those who listen it. If anyone Salutes Salaam to them, then there is no obligation on them to return except those who listen the Khuthuba, but returning is obligatory on them. It is disliked to return Salaam by those who engage in sexual intercourse and cleaning of urine or excreta and desirable to those who eat or drink. It is voluntary for those who are in the prayer, Adhan or Iqhamah to return salam by gestures or by word after the completion if interval does not become long. The messenger of Allah said “If any of you reach in an assembly then he should say salam to them" (Abu Davud, Thurmudi). Repeating of salaam is desirable when meeting repeats. See the statement of our prophet (PBH) “If any of you saw his brother he should say Salaam and if any like tree, wall or rock covers between them and they meet again, he should say salaam again (Abu Davud)
Sending Salaam by letter or messenger to one who deserves it, is sunnath and it is obligatory on the messenger to carry out, as it is a Amana and returning of salaam so received is vajib (obligatory). But, one can return the salaam received letter, though letter or word. It is better to return by saying Va Alaika Va alaihi Ssalam including the messenger also. One should say Salam when he enters to his house. The Almighty Allah says “If you enter houses, salute each other- a greeting of blessing and purity as from Allah (The holy Qur'an: 24:61).Our venerable prophet (PBH) said to his dear servent Anas (R) “my child, when you enter to your family members salute Salaam to them which will become 'Barakah' to you and your family members" (Thurmudi). To enter others houses it is necessary to ask permission and salute salaam to them. Allah says “Oh! You who believe enter not houses other than your own, until you have asked permission and saluted those in them; that is best for you, in order that you may heed (what is seemly). If you find one in the houses, enter not until permission is given to you, if you are asked to go back, go back: That maker for greater purity for yourselves: and Allah knows all that you do (The holy Qur'an)