I found this in a "Science Daily" article:
Defibrillation is a medical technique used to counter the onset of ventricular fibrillation, (VF) a common cause of cardiac arrest, and pulseless ventricular tachycardia, which sometimes precedes ventricular fibrillation but can be just as dangerous on its own.
Defibrillation is a technique used in emergency medicine to terminate ventricular fibrillation or pulseless ventricular tachycardia.
It uses an electrical shock to reset the electrical state of the heart so that it may beat to a rhythm controlled by its own natural pacemaker cells.
It is not effective for asystole (complete cessation of cardiac activity, more commonly known as "flatline") and pulseless electrical activity (PEA).
The purpose of defibrillation of ventricular arrhythmias is to apply a controlled electrical shock to the heart, which leads to depolarization of the entire electrical conduction system of the heart.
When the heart repolarizes, the normal electrical conduction may assert itself, in which case the ventricular arrhythmia is terminated.
However, if not enough energy is used for defibrillation, the heart may not be completely depolarized, in which case the ventricular tachycardia or fibrillation may not be terminated.
Also, if the heart itself is not getting enough oxygen or if there is an instability of the electrolytes in the cardiac cells, the ventricular arrhythmia may recur.
Note: The above text is excerpted from the Wikipedia article "Defibrillation", which has been released under the GNU Free Documentation License.