Why does? An electrical shock delivered to the heart? Correct abnormal heart rhythms?

Rebooting the system. Our heart works through electrical pathways. If these pathways get out of sync or mixed up then sometimes cardioversion or defibrillation a.K.A. "reboot of the system" can get the electricity back in sync.

Related Questions

What is an electrical shock delivered to the heart to correct abnormal heart rhythms called?

Defibrillation. If it's a potentially fatal heart rhythm (eg ventricular tachycardia or fibrillation), it's called defibrillation. In this case, a large amount of energy is delivered directly to the heart to stop it so that the internal pacemaker can re-activate it to a (hopefully) normal rhythm. In all cases, CPR (chest compressions) are required as well. Read more...
Cardioversion. If non-fatal (like atrial fibrillation), it's cardioversion in which a lower energy & specific electrical phase is given with the patient sedated but awake so that the rhythm can be converted to the normal, sinus rhythm. Read more...
Cardioversion-defib. An implantable aicd has cardioversion and defibrillation capabilities. However, usually, it delivers a defibrillatory shock when it detects a dangerous rhythm. Of course, the energy is much lower since less tissue needs to be penetrated (the electrical lead goes directly into the heart). Read more...