Q. A friend’s dog died suddenly, the family was very much attached to the dog that was with them many years and feel very devastated and crushed. Is it correct to go and visit them and console them?
What does one say to them?
Is it correct for their neighbours and friends to offer a kidush to show their care and support?

A. The Talmud (Brochos 16b) relates that when the Canaanite maidservant of Rabi Eliezer died his students came to console him, when he saw them he ascended to the upper chamber, but they ascended after him. He kept on and on trying to avoid them but they stubbornly kept following him, until he confronted them and told them: Have I not thought you that upon the death of one’s Canaanite slaves and maidservants… we do not say for them the mourners’ blessing or the mourners’ condolences. Rather what do we say for them? Just as we say to a person over his ox and his donkey that died; “Hamakom Yimaleh Chessroncha,” May Hashem replace your loss, so we do too in this case.
This Halacha is quoted both in Rambam (H. Avel 12: 12) and in Shulchan Aruch (Y.D. 307: 1).
Ben Yehodaya (Brochos ibid.) explains the continuous avoidance of Rabi Eliezer to meet his disciples, mentioning that he was thinking they came to offer his condolences as we normally do in a regular shiva for a close relative. Since that conduct is improper for the loss of anyone or anything else, as we are not required to visit then the afflicted. It suffices to say the words mentioned above when one encounters the distressed.
Horav Shlomo Millers Shlita opinion is that one may visit socially the devastated, suffering friends and express ones feelings of empathy and compassion by sharing in their loss, as one would after a fire or similar. Acts that would be part and parcel of the mitzvah of Veahavta Lereacha – loving another person as ourselves. However, in regards to offering a kidush, one must be careful as it could be ill-interpreted as serving it for the sake of the dead animal.

Rabbi A. Bartfeld as revised by Horav Shlomo miller Shlit”a