Shaking Leg

Why does it feel so good for some of us? I used to do it in school until enough people quietly stopped me. Now I just do a good foot shake for each leg before going to sleep (except when I am spending the night with a lady). It just seems to relax my legs. Why?