“the house of mourning.” There were no funeral homes in the ancient near east. When a person died, they were kept in the home in which they lived and died until the grave was prepared and the person was buried, often late in the afternoon. People of the village would go to the person’s house, the “house of mourning,” and pay their respects and comfort the family. God told Jeremiah not to go into a house of mourning because God had removed His blessing from Judah and many people would die in the wars with Babylon (Jer. 16:5).
To “go to the house of mourning” is to go to visit and comfort the family of the dead person and to consider things about life and death. It does not mean that you go to live there, or constantly live in a morose and depressed state thinking about death. Given the two choices, going to a house of mourning or going to a house where there is a feast and party, the Sage says that it is “better” to go to the house of mourning because death is the end of all people and we cannot lose our focus on that and live as if there is no Day of Judgment coming for us in the future (cp. Ecc. 11:9; 12:13-14).
“for that is the end of all humankind.” “For that” refers to being dead and in the house of mourning. It is commonly taught in business that if a person is going to be successful they must “begin with the end in mind,” whether “the end” is the goal for the day, the year, or one’s working life. Similarly, if we are going to be fully successful with God, we should live the same way, keeping “the end,” our death, in mind, because we are only here for a short while and then will stand before the Lord on Judgment Day. That there is a day of judgment coming for every person should not surprise anyone because God has said a lot about it. God wants every person to have a good day on Judgment Day, so He tells us to take our mortality to heart and live in a way that will please Him.