If your cat doesn't seem to want to sit still while you pet it, you might be doing it wrong. Yes, it turns out there is a right and wrong way to pet a cat, per a study published in Applied Animal Behaviour Science in late 2014. As the researchers from UK's University of Lincoln note in their abstract, "As part of its role as a pet, cats are expected to not only tolerate but enjoy being touched." They set out to determine how one should best do that via two experiments, which zeroed in on "handler familiarity," the cats' various body regions, and the order in which they were touched. The upshot: Leave the tail alone. That "caudal" region returned the most negative scores regardless of how familiar the petter was.
The Washington Post explains the tail area "is sort of a cat erogenous zone, and petting may overstimulate it." It further points to a 2002 study that echoes that caudal finding and says that petting in the temporal region (between the eyes and ears) was most preferable. As for whether you start with the ears or the back, the study showed the order of body region touched didn't really matter. One odd finding that needs further investigating, per the researchers: Negative responses were higher when owners, not strangers, stroked the cats. University of Lincoln researchers have examined the topic before: In a 2013 study they found that cats who dislike being petted but allow their owners to do so may be stressed out. (Another recent study found cat owners may be in denial about their darling pets.)