The basic idea of a stun gun is to disrupt the nerve communication system. Stun guns generate a high-voltage, low-amperage electrical charge. In simple terms, this means that the charge has a lot of pressure behind it, but not that much intensity. When you press the stun gun against someone and hold the trigger, the charge passes into that person's body. Since it has a fairly high voltage, the charge will pass through heavy clothing and skin. But at around 3 milliamps, the charge is not intense enough to damage the person's body unless it is applied for extended periods of time.
The charge does dump a lot of confusing information into the person's nervous system, however. The charge combines with the electrical signals from the person's brain. This is like running an outside current into a phone line: The original signal is mixed in with random noise, making it very difficult to decipher any messages. With the stun gun generating a ton of "noise," the person has a very hard time telling his or her muscles to move, and he or she may become confused and unbalanced. He or she is partially paralyzed, temporarily.
The current may be generated with a pulse frequency that mimics the body's own electrical signals. In this case, the current will tell the person's muscles to do a great deal of work in a short amount of time. The action in the muscles is actually happening at a cellular level, so you couldn't really see the person twitching or shaking -- the signal doesn't direct the work toward any particular movement. The work doesn't do anything but deplete the person's energy reserves, leaving him or her too weak to move (which is the whole idea as you would normally be using a stun gun against an attacker).
A stun gun's effectiveness can vary depending on the particular gun model, the size of the person being zapped and the duration of the actual zap. If you use the gun for half a second, a painful jolt will startle the person. If you zap him or her for one or two seconds, he or she should experience muscle spasms and become dazed. And if you zap him or her for more than three seconds, he or she will become unbalanced and disoriented and may lose muscle control. However, determination can be a mitigating factor. Determined attackers with a certain physiology may keep coming despite any shock.
For more information on stun guns, electricity and related topics, see the links below.
Related HowStuffWorks Articles