Sarcasm is usually innate; however, if you would still like to attempt developing this ability, your chances of success would be greatly increased if you are intelligent, or at the least not mentally incapable of detecting and reproducing sarcastic remarks.
"It was only supposed to be a joke, I never thought people would take the book seriously. Anyone with half a brain can see that object-oriented programming is counter-intuitive, illogical and inefficient."