Oftentimes, patting someone on the back is a sign of being uneasy or uncomfortable. Other times, back pats represent someone being friendly but offering limited affection.
According to Streetdirectory.com, a back pat during a hug represents either being uncomfortable or a desire to end the hug; the bigger the pat, the more uncomfortable someone is. According to Changing Minds and Study-Body-Language.com, a back pat represents a desire to end a hug or a nonverbal signal to let go, especially during a longer hug. During shorter hugs, back pats represent giving a limited amount of affection in the hug. A "man hug," involving a quick grab and patting the other person's back a few times, often represents a greeting between male friends that represents friendship but nothing romantic.