Electrolysis is the breaking up of a substance using electricity. It requires a liquid to conduct the electricity called the electrolyte. Electrolytes are often metal salt solutions made from the ore or molten metal oxides. The electrolyte has free ions these conduct the electricity and allow the whole thing to work. Electrons are taken away from the positive anode and given away by the negative cathode. As ions gain or lose electrons they become atoms or molecules and are released.
How is electrolysis used to purify copper?
Electrons are pulled off copper atoms at the anode, causing them to go into solution as Cu2+ ions. Cu2+ ions near the cathode gain electrons and turn back into copper atoms. The impurities are dropped at the anode as sludge whilst pure copper atoms bond to the cathode.