A few notes on how to offer condolences to the family of the deceased:
1. It is sunnah to send food to the family and also help them take care of their affairs so that they dont have to worry about anything else besides grieving. When the news of the death of Jafar ibn Abi Talib came to his family, the Prophet (salAllahu alayhi wa salam) said to Fatima: 'Prepare food for the family of Jafar, for there has come to them what has preoccupied them (Abu Dawud)." The phrase "what has preoccupied them" shows us that whatever we can do to help them in regards to their worldly affairs is good. So running errands for the family, informing their employers or school administrators so that they dont have to, buying groceries for them, offering financial support, etc. are all things that lighten the load for them and fulfill this noble purpose.
2. Condolences should be offered to them whenever you see them at the janaza or in public. Malik and Ash Shafi said in the masjid or in the marketplace when they go about their business. In our days you can send a text message, email, etc. so that your condolence still reaches but you dont burden the family with having to receive you. "Condolences are desirable, even if the deceased was a non-Muslim. Ibn Majah and Al-Baihaqi reported from 'Amr ibn Hazm that the Prophet, peace be upon him, said: "Every believer who consoles his brother in distress, will be dressed by Allah in an apparel of honor on the Day of Resurrection." It is recommended, however, that the condolences be offered only once." (Fiqhus Sunnah)
3. Organizing gatherings (bayt azza) or feasts is a tradition of the days of ignorance that Islam prohibited. Jarir Ibn Abdillah (ra) said: "We, the companions of the messenger of Allah (salAllahu alayhi wa salam), used to consider gathering with the family of the deceased and preparing food after the burial from niyahah (prohibited form of wailing from the days of ignorance)." People have rituals with these gatherings until today that are identical to the azza gatherings of quraysh. In many middle eastern countries they even pay professional mourners (called naai'hat) and Quran reciters to come to these gatherings. The pre islamic arabs used to pay poets to come recite. Families serve "black coffee" which is a pagan ritual to signify their grief. As a result, not only is the family burdened with having to host the guests, but they also are burdened financially. These gatherings serve the exact opposite purpose of the sunnah which is to lighten the load of the family. Having previously served as Imam for 6 years, i saw families literally have breakdowns because they were sick of having to entertain guests but their cultures forced it upon them. Having myself suffered the tragedy of losing my mother, i wanted to be left alone but instead had to deal with people coming and sitting in my house uninvited and talking about everything BUT death.
Sayyid Sabiq (RA) wrote in this regard: "The sunnah concerning this is that one should offer condolences to the bereaved family and leave. Neither the consoler nor the consoled should sit down. This is the lesson we learn from the example of our righteous predecessors. Ash-Shafi'i in his Al-Umm said, "I hate the gathering in groups together to give condolences even if those gathered do not cry. Such a gathering revives sorrow and adds to the grief and burden of the bereaved family. An-Nawawi said, "Ash-Shafi'i and his companions disliked sitting for condolences, whereby members of the family stay in their homes to receive anyone coming to give their condolences. Instead, they should go about their usual tasks and needs. This applies both to men and women. Al-Muhamili states this explicitly and transmits it in reference to a text from Ash-Shafi'i. This is makruh tanzihi (Makruh tanzihl signifies something which is undesirable yet is closer to the lawful) unless it is coupled with some other innovation. If it is accompanied with another forbidden innovation (bid'ah), as is generally the case, then it is regarded as one of the strongly forbidden acts. All such acts are an innovation, and as a sound hadith says, "All invented acts are an innovation and every innovation is error." (Fiqhus Sunnah)
Abu Bakr al-Turtushi al-Maliki (d. 520H) wrote:
"Our Maliki scholars have said: To undertake preparation for condolences (i.e. organize sittings) is an innovation and disliked. So [a person afflicted with the calamity of the death of a family member] sits in his house, or in the mosque, in his sadness, but without presenting himself to receive condolences. In this case there is no harm. When the news of the death of Ja'far came to the Prophet (sallallaahu alayhi wasallam), he sat in the mosque, overcome with sadness and the people came and gave condolences to him."
4. With that being said, the sunnah is to make things easier on the family and different people grieve in different ways. If the person wants to have certain family members and friends around in no formal capacity but to make things easier on them, than that is fine. If the family wants to be left alone than that should be their choice also.
5. The sunnah way to console the family is to say to them what the Prophet (salAllahu alayhi wa salam) said to his daughter when she lost her child:
inna lillahi ma akhatha wa lahu ma a'Ta wa a'ndahu kulla shay'in fi ajalin musamma, fal taSbir wal ta'htasib.
'Verily, to Allah belongs what He has taken, and to Him belongs what He has given. For everything He has set a term. So be patient and be content'.'' (Bukhari)