First, let us just note that the entire genre of tragicomedy might best be summed up by Nell's line early in the play: "Nothing is funnier than unhappiness… Yes, yes, it's the most comical thing in the world" (1.194-196). The line contains the exact mixture of the morose and the comic that makes up the genre without quite explaining why unhappiness can be funny.
Now, the play is undoubtedly and undeniably a tragedy. There's no getting around it. It takes place after the end of the world. Everyone is dead except for four characters that are incredibly cruel to each other. There is, in fact, very little hope in the play. Beckett has imagined a situation in which things are already as bad as they can possibly get. What is more, the play ends on an ambiguous note. It's not even a decided tragedy. If Clov leaves Hamm, then Hamm and Nagg will die. And Clov will, too, out on his own. If Clov stays, then he simply continues to give in to the master who treats him so poorly. He simply prolongs their deaths a little longer.
And yet… Like Waiting for Godot before it, the play is tremendously funny. The characters never cease to search for ways to infuse their situations with humor. The comedy keeps the play from being so depressing as to be unwatchable. What's more, though, when we laugh with the characters, we are also relating to them, even in their extreme, exaggerated circumstances. Laughter is a way of drawing us, the audience, into the tragedy, forcing us to sympathize with these characters rather than just pitying them from a distance.