The only time to fold a set is when there's a very obvious flush or straight on the board, you know your opponent has it, and there are no more cards to come. You will probably never be a good enough poker player to sniff out a higher set when you flopped one, so don't try; just get your money in. (And I don't mean you specifically, I mean basically everyone who plays poker.)