You don’t, really. The best you can do is make an educated guess. If something seems absurd enough or offbeat enough or somehow wrong, then it might be humor. But you can go wrong on this—I did just recently. I couldn’t believe someone wasn’t making a joke, but it turned out they were serious. Go figure.