Why does my dog kick his leg?

When I scratch my dog (and many of my friend’s dogs) on the lower back really quickly they tense up and start kicking their hind leg. Why ?

This question has been covered recently. Why does my dog’s leg shake when I scratch his belly?