It���s the unpleasant feeling that makes us instinctively scratch and scratch and scratch. So why does a fingernail almost instantly make an itch feel better?

J R Traver began to itch around her 40th birthday, and would continue to scratch away at her skin until her death some 40 years later. The zoologist was convinced that she and two other female relatives had been hosts to a skin parasite, a mite called Dermatophagoides scheremetewskyi. After 17 years of attempting to rid her body of the mites, the scientist even published a paper about her bodily infestation in the journal Proceedings of the Entomological Society of Washington, presumably in an effort to find someone who might help.

To treat the problem, she visited physicians, dermatologists, neurologists, and others. She used dangerous pesticides at unhealthy levels, over and over again, in an effort to kill off the bugs. Using her fingernails, she dug the mites out of her skin, mutilating her body in the process. Some of the skin samples she took from her body and scalp would be mailed to entomologists. One clever doctor referred her for a psychological evaluation, but she managed to convince the neurologist that his services were not needed. “To date, no treatment applied has been able to bring about complete eradication of the mites,” she wrote.

We now know that the Traver did not have a mysterious colony of mites living on and inside of her skin, and the skin of her family members, for 40 years. She suffered from a psychiatric disorder called delusory parasitosis, a condition in which patients try to find physical evidence for the sensations they perceive, often to their own detriment.

Traver’s story is similar to those of others who suffer from delusory parasitosis, but it still remains a fairly rare occurrence. Such complaints typically take up less than 2.5% of dermatologists’ time. But itching more generally is an everyday occurrence for just about everybody on the planet.

And nobody knows exactly what it is.

At first glance, itch and pain seem to be related

 The definition still accepted by most doctors and researchers today was put forth some 350 years ago by a German physician named Samuel Hafenreffer. He wrote in somewhat circular manner than an itch is any “unpleasant sensation that elicits the desire or reflex to scratch”. If you scratch, then the sensation that provoked it is by definition an itch. It’s a definition that may be reliable, but it’s probably not all that useful.

At first glance, itch and pain seem to be related. The skin is studded with an array of nerve endings called nociceptors whose job is to relay information about the presence of potentially damaging stimuli to the spinal cord and brain. A weak assault on those neurons results in an itch, while a fully fledged attack results in pain.

That’s according to the “intensity theory”. But there’s an alternative, the “specificity theory”, which holds that some neurons are responsible for pain, while a different set cares about itch, which is more formally known as “pruritus”. Or it could be that there’s a single set of neurons responsible for nociception, but that they can somehow tell the difference between stimuli that are itchy and those that hurt.

Obsessive scratching

That itching can arise for so many different reasons doesn’t help. To start with, there’s acute itch, the type most of us are familiar with, which could arise from something as simple as an insect bite. Then there is the more chronic, pathological type of itch that could be associated with dry skin, eczema, psoriasis, or other skin diseases. Brain tumours, multiple sclerosis, chronic liver disease, lymphoma, Aids, and hyperthyroidism have all been associated with chronic itch, as have diseased neurons.

Then there are the psychological and cognitive factors, but not all are as creepy as delusory parasitosis. An obsessive need to scratch can be a manifestation of obsessive-compulsive disorder; in these cases, persistent scratching can damage the skin and only serves to exacerbate the problem.

That the itch sensation can be reduced by the application of painful stimuli only makes it an even more curious phenomenon. Scratching is a relatively minor form of pain, but the light pain we experience raking our nails across our skin does seem to help, as does the application of cold, or heat, capsaicin (the chemical that gives peppers their heat), or even a few electrical zaps. This means, paradoxically, that analgesics, which are meant to reduce pain, can actually enhance itch.

The confusion between pain and itch notwithstanding, there’s a fairly straightforward difference between the two. When something hurts, our body responds with its withdrawal reflex. Put your hand near a candle’s flame and you'll experience the overwhelming desire to pull it back.

But the scratching reflex brings attention towards, rather than away, from the affected skin. That actually makes good sense, and points to one possible evolutionary origin for the scratching reflex: closer inspection and a quick scratch is more effective at removing a crawling insect than would the withdrawal reflex. Scratching is a good way to remove not just insects and parasites, but also bits of plants and any other unwanted material hitching a ride on your skin or in your hair.

Like yawning, itching can be contagious

Here’s how it works: when something bothers the skin, like a mosquito bite, cells release a chemical, usually histamine. That release provokes the nociceptors in the skin to send a message to the spine, which then relays the message through a bundle of nerves called the spinothalamic tract up to the brain.

In 2009, researchers used a histamine injection to make the legs of their non-human primates itch while an electrode monitored what happened inside their spinothalamic tracts. As soon as the histamine was injected, those neurons began to fire, and fast. When the researchers offered up a few scratches, those neurons slowed their fire. Their electrodes told them that scratching does its work in the spinal cord rather than in the brain. (Indeed, there is no "itch centre" in the brain.) But when scratching came before the injection, it didn’t provide any relief. Somehow, the spine knows when scratching is helpful and when it isn’t.

Are you getting itchy yet? If you are, it’s because, like yawning, itching can be contagious. Physicians say that they start feeling itchy after treating patients for scabies. And researchers once gave a lecture on itching just to see if they could get their audience to feel itchy, and it worked. Hidden cameras revealed that the audience spent a lot more time scratching themselves during that lecture than during a talk on a more innocuous subject. Contagious itching has even been seen in monkeys, hinting at the tantalising possibility that there could be an evolutionary advantage to scratching ourselves when we watch others scratching themselves.

And consider this: scratching isn’t usually thought of as painful and can be downright pleasurable. In a 1948 paper in the Journal of Investigative Dermatology, Washington University School of Medicine neurophysiologist George Bishop noted the puzzle, writing, “scratching an itch with a violence that would cause pain elsewhere may be experienced as one of the most exquisite pleasures”. And while this makes back scratches from a loved one quite enjoyable, it can also lead to serious problems for those with chronic itching-related diseases. Patients with eczema have reported that they scratch not until the itch has subsided, but rather until it no longer feels good to scratch.

“Happiness,” said Ogden Nash, “is having a scratch for every itch”. The American poet was probably more right than he knew.

Join 500,000+ Future fans by liking us on Facebook, or follow us on Twitter, Google+, LinkedIn and Instagram.

If you liked this story, sign up for the weekly features newsletter, called “If You Only Read 6 Things This Week”. A handpicked selection of stories from BBC Future, Earth, Culture, Capital, Travel and Autos, delivered to your inbox every Friday.