A solid ionic compound cannot conduct electricity because its ions are locked in place. If the compound is melted, or dissolved in water, the ions can move about freely. Either liquid is able to carry an electric current and is called an electrolyte.
When a current passes through an electrolyte, the ions travel to the electrodes. Positive ions are attracted to the negative electrode, the cathode. Negative ions are attracted to the positive electrode, the anode. At each electrode the ions are discharged, which means they become uncharged atoms, so an element is produced.
This whole process is called electrolysis. It splits an ionic compound into its elements using electricity.