Tapping the tendon stretches the quadriceps muscle.
Sensory neurons send the signal to the spinal cord, where motor neurons relay the information to the quadriceps, causing it to contract and jerk the lower leg up.
The Sensory neurons also communicate with interneurons which send inhibitory signals via other motor neurons to the hamstring, preventing it from contracting.