Electrolysis is the separation of chemicals using an electrical field. 'Lysis' literally means 'breaking down', and 'electro' means it is done with electricity. The process has enormous practical importance, as well a huge role in the history of chemistry - in the space of less than two years in the first decade of the 19th century, Sir Humphry Davy used electrolysis to isolate six new chemical elements1 - first sodium, then potassium, calcium, barium, magnesium and strontium.

Electrolysis works because many chemicals decompose into ions - charged particles - when they dissolve in water, or they melt. Substances like this are known as electrolytes. In an electric field, the two kinds of ions will travel in opposite directions, each building up on one or the other electrode. Ionic compounds, like salts, always split up into positive and negative ions when they enter a liquid state, since they are made of ions in the first place. Acids also split into ions in water. Every acid includes at least one hydrogen atom, which is prone to detaching from whatever molecule it's part of and attaching itself to a nearby water molecule instead. The hydrogen leaves behind its electron when it does that, so the rest of the original molecule is left with the electron's negative charge, while the water molecule becomes a hydronium ion, with the positive charge of an added proton. In an electric field, the two ions then go their separate ways.

When the positive ions (cations) arrive at the negative electrode (the cathode) they pick up electrons and return to their uncharged state. Similarly, when the negative ions (anions) arrive at the the other electrode (the anode) they deliver their spare electrons, completing an electric circuit. This is how solutions of electrolytes conduct electricity. The newly uncharged atoms are left free to form new bonds - atoms of gas will join up into small molecules which build up to make bubbles, while solids will accumulate around the electrode.

Electrolysis is used in industry whenever electrolytes need to be separated into their component parts, and that includes a lot of different circumstances. Chlorine is extracted from sea water in large quantities, for example, to be used as a bleach and a component in products like PVC. Aluminium is extracted from ore by electrolysis, as are all of the most reactive metals, the ones that can't be extracted just by heating them with carbon. Submarines can stay underwater for months at a time by using electrolysis to separate water into hydrogen and oxygen2, and since both chemicals have numerous other uses, this process also has some industrial importance. Electroplating and anodizing are also based on electrolysis - one usually used to deposit a layer of pure metal onto a surface, the other used to deposit a layer of oxides.

References

1Yale
2Edexcel GCSE Science