I've always felt it was a combination of Reading Comprehension Skills and Reading a Situation, with a teeny tiny part of knowing the person.
Tone in -general- is often something people with not-so-good reading comprehension will struggle with. If they have issues understanding sarcasm, they'll often have issues understanding when a sentence was meant to sound forceful, flat, excited, etc. Sarcasm possibly being THE hardest tone to understand, would be a huuuuuge issue for anyone that doesn't have a good gasp of reading tones.
Reading a situation goes in hand with this, because you have to look at not JUST the one comment, paragraph, etc, but at the whole conversation to understand the meaning and tone behind the words. Like, if you take a vague line quoted out of a random movie, you can't be 100% sure if that phrase was said in anger, love, frustrations, etc, unless you know the bigger picture of the scene. To understand sarcasm in a conversation, you need to be aware of the context to be able to pick it up.
And the last part is knowing the person. You don't have to know the personally, and I say this is only a teeny part because it's not REQUIRED to understand when sarcasm is being used. But it does help a lot. You're way more likely to understand and recognize when a person is being sarcastic when you're familiar with the personality, and the way that person interacts with others.
That is my opinion anyway! 8D