A normal heart has a regular beat, and to pump blood, it is coordinated so that the upper chambers of the heart contract before the bottom chambers of the heart contract. When these contractions become disorganised, it is called ventricular fibrillation, because the lower chambers (the ventricles) flutter rather than beat.
If the heart is not contracting in a coordinated manner, very little or no blood will be pumped by the heart. This is not good for the person, since a regular blood supply is needed by all parts of the body. Ventricular fibrillation can cause someone to die within an hour.
A defibrillator monitors the heart rate. If it goes too fast (quivering or spasming) the defibrillator sends an electrical shock to the muscles in the ventricle. This is thought to depolarise the cells of the ventricle all at once, like a restart button, allowing the electrical system of the heart to initiate a regular rhythm.
It is now possible to get small electronic devices that can be implanted under the collarbone, which connect electronically through wires to the heart. These devices monitor the heart and can deliver a shock to get it back to its normal rhythm.