1) The mitzvah of nichum aveilim is numbered amongst the greatest of mitzvos because it is one of the methods to emulate Hashem for Hashem himself comforted Yitzchak after the loss of his father. (Gemara Sota 14a) Rabbeinu Yonah (beginning of third perek) writes that comforting mourners is a form of the biblical obligation of doing chesed. However, the Rambam (Avel chapter 14) writes that the obligation is rabbinic in nature. (For further discussion as to the opinion of the Rambam, see: Megilas Esther on Sefer Mitzvos Shoresh 1, Rav Perlow on Sefer Hamitzvos Rasag vol. 1. mitzvah 19, Shut Maharetz Cheyos 70.)
2) The Chafetz Chayim (Ahavas Chessed chapter 5) writes that the main obligation of nichum aveilim is to alleviate the pain of the mourner. A similar view was advanced by the Shlah hakadosh (cited by Sefer Netai Gavriel on hilchos Aveilus vol. 1 page 466) who wrote that, “The mitzvah (of nichum aveilim) is to speak to the mourner with comforting words, until he momentarily forgets about his pain”. Rav Moshe Shternbuch Shlit”a (Teshuvos V’Hanhagos 4:274 chapter 9) expresses a similar explanation of the mitzvah. He warns, however, against discussing mundane matters, unrelated to that of the deceased, but rather, to tell stories of the niftar and to discuss his good qualities. Upon hearing this, the mourner will (hopefully) become comforted. [Yet, it goes without saying that if telling stories of the niftar will cause the mourner pain, one should not do so. The main objective is to cause comfort and not chas v’shalom pain for the mourner, v’ten l’chocham v’yechkam od.]
3) Many seforim cite the minhag not to be menacheim during the first three days after the funeral. (See Gesher Hachaim vol. 1 page 209, Teshuvos Vehanhagos 4:274 chapter 9, Sefer Chesed Shel Emes page 415, Netai Gavriel on hilchos aveilus vol. 1 chapter 86.) One of the reasons given is that since the first three days are designated for crying over the loss (see Gemara Moed Katan 14), it is difficult for the mourners to accept comfort. Therefore one should wait three days until the mourners are more readily accepting of nechama. The Gesher Hachaim writes that since this is just a minhag if there are extenuating circumstances one may go during the first three days. In addition Rav Yaakov Kamanetzky zt”l (Sefer Emes L’Yaakov footnote on page 394) testified that the minhag in Lithuania was to be menacheim even on the first day. A similar permissive view was advanced by the Lubavitcher Rebbe zt”l in the sefer Shaarei Halacha U’minhag (Yoreh deah 137).
4) Rav Moshe Shternbuch (Teshuvos V’Hanhagos 3:377, 4:274 chapter 9) extends a novel idea. He feels that the aforementioned minhag applies only to those who have specific words of comfort to tell the mourners. In that case one should wait the three days so that the mourners will be more responsive. However, the majority of people who just go to show support (and only say “Hamakom Yenachem…”) may go at any time. On the contrary, he adds, many mourners have a difficult time sitting alone for so long and the mere presence of people may ease the pain.
5) There are those who have the custom not to perform nichum aveilim at night. However, most poskim disqualify this minhag and write that one may fulfill the mitzvah even at night, see Gesher Hachaim vol. 1 page 209 and Yabia Omer (Rav Ovadia Yosef zt”l) vol. 10 page 299.
6) The Rambam (Avel 14:7) says that there are two facets to mitzvas nichum aveilim: The first is to comfort the mourners who are distressed over the death of a loved one. This can be done by expressing sympathy to them and consoling them over their loss. One’s mere presence at a house of mourning is a show of respect and a source of comfort at a time of sorrow. The second part of the mitzvah is for the sake of the deceased. By visiting the home of the deceased during the Shivah period, one “elevates the soul” of the departed individual. [Based on the Talmud (Shabbos 152a) which states that ten people should sit shiva in the house of the deceased even if the deceased left no mourners behind.] Accordingly, Harav Moshe Feinstein zt”l (Igros Moshe Orach Chaim vol. 4 number 40:11) rules that while it is possible to console a mourner over the telephone, it is not possible to “elevate the soul” of the deceased unless one actually comes to the house of mourning. Nor does one show proper honor to a mourner through a mere phone call. Thus, if one can, he must be menachem avel in person. If, for some valid reason, he cannot visit the home of a mourner, he should still call him and console him and thereby fulfill at least part of the mitzvah. [He continues to explain that the mourner may come to the phone and accept a caller’s words of condolence. He may not, however, speak about other matters or ask about the welfare of the caller, even if the caller is a child or close relative.]
7) Many achronim rule in accordance with Rav Moshe; including the Rav of Debrezin in Sefer Beer Moshe (2:104, 7:2:58), Shut Divrei Shalom 4:57, Sefer Nishmas Yisroel page 117, and Harav Ovadia Yosef in Sefer Yabia Omer vol. 10 page 299. Similarly Rav Moshe Shternbuch (Teshuvos V’Hanhagos 2:587) writes that if one is unable to visit the mourner in person he may send a letter of condolence. For a dissenting view see Sefer Pachad Yitzchak (Igros U’ksavim 33).