A favorite quote of mine: "Sarcasm is thinly veiled anger."
Something else that stuck with me is the idea that when your sarcasm becomes so advanced, people think you're stupid.
As in, sometimes people take the sarcastic person at face-value, which could frustrate, enrage, or entertain the sarcastic person.
Sarcastic characters can be entertaining, but when they have a REASON for their jaded/wounded attitudes, they become compelling. Why would a character need sarcasm to emotionally shield themselves, or vent frustrations they can't otherwise express? (Maybe the environment doesn't allow dissent; maybe the character lacks the skillset to communicate directly.) Sarcasm can be passive-aggressive.
Sarcasm pairs well with black, deadpan, tongue-in-cheek, and/or facetious humor. Like Cabernet and steak.
One of my fave Youtube comedy skits:
Everyone's Upstairs Neighbors (SFW)
Note that whoever made this video most likely, at one point, HATED their upstairs neighbors (veiled rage element).
I live and die for Jon Lajoie, too (he's a comedian with a channel on Youtube, NSFW). He uses humor to deal with dark subject matter.
So for sarcasm to be effective, IMHO, it has to be either a jab at or a deflection of a deeper issue, something the character feels strongly about.