The capacitor builds up a charge, and releases it to the electrodes, which are at the end, and are brought in contact with the body of the attacker. As the gun makes the contact, the high voltage charge, which is inside the circuitry, gets shifted to his body, as the electric circuit gets completed. And the charge is passed to the attacker's body.