Excellent question
Found on Quora:
How did we just magically figure out that itching relieves bug bites?
It's deeper than it sounds. Scratching is a complex intelligent skill requiring lots of target-seeking. It's not a simple reflex like pulling away from pain. Sometimes scratching requires the use of a tool like a tree or fencepost, especially among animals with less flexible limbs.
All mammals do it, and I suspect birds do it as well.
How did evolution magically lead to this complex response?
Labels: asked and worth asking again, Grand Blueprint