By observing my own body, I noticed that there are three types of itching.
The first is the itching of dry crusts over sores. In my opinion, this is an obvious urge of the body to get rid of the dried crust.
The second is itching from dirt. It can be assumed that the dirt clogs the pores on the skin, and the body needs to "shake up" this place. (perhaps the mechanism of the onset of itching here is the same as in the first case)
The third is an inexplicable desire to scratch itself. By analogy with the first two types, I assume that this is due to blockage of some tubules, or another malfunction of the skin. It is worth scratching, and everything goes away.
To summarize, itching is a signal from the body to help a person in those matters that he cannot solve with his biological mechanisms.
Because itching is a "harbinger" of pain. These are weakened impulses from pain receptors, which, however, can appear not only before, but also after, and instead of pain. This is a kind of warning: a little more - and it will hurt.
But itching can occur not only as a reflection of real sensations, but also as a result of "glitches" of the tense nervous system. Many are familiar with the condition when, after an eventful day (and, even more so, evening), when falling asleep, the head or body suddenly begins to itch. This is the result of the accumulated nervous tension "coming out", directing unrealized impulses along the most harmless path.