"Certain breeds show a propensity for specific types of compulsive behaviors."
©Scott Sheaffer, CPDT-KA, USA Dog Behavior
Yes, dogs can have OCD (Obsessive Compulsive Disorder) that manifests as tail chasing, licking their paws until there is an injury (lick granuloma), fly snapping (biting at imaginary flies), flank and blanket sucking (literally sucking on their rear legs or on inanimate objects), pica (eating non-food items) and the list goes on. Many pure behaviorists object to calling this behavior OCD because we can't know what the dog is actually obsessing or thinking about. They prefer to simply call this behavior a compulsive disorder.
Just like with people, these repeated behaviors serve no real purpose and can go on for hours at a time. The behaviors are in response to anxiety that is relieved with the neurochemical changes these seemingly non-stop behaviors produce. A pattern of anxiety - compulsion - relief - reinforcement is started which makes these behaviors difficult to stop. Certain breeds show a propensity for specific types of compulsive behaviors. Examples include: Dobermans (flank sucking), German Shepherds (tail chasing), Golden Retrievers (light chasing), English Bull Terriers (freezing), Cavalier King Charles Spaniels (fly snapping).
Diagnosis can be difficult as there are other causes for these behaviors including attention getting behaviors reinforced by owners and physical problems such as gastrointestinal issues.
Typical treatment is through behavioral modification and medication. We use many of the same medications that are used in the treatment of human OCD. Further evidence, in my opinion, that the cognitive processes in humans and dogs are similar in many respects.
While this behavior may be funny to observe, the impact it can have on a dog's quality of life can be devastating in many ways. Needless to say, if you have a dog who you believe is presenting with OCD behaviors, please seek out a professional who specializes in dog behavioral issues.