electrolysis is basically the splitting up of an ionic compound using electricity.
As I'm sure you know, the metals form positive ions with ionic bonding and the non-metal forms a negative ion.
Therefore, the positive metal ions of the compound will be attracted to the negative electrode and will gain electrons (we say that the ions are 'reduced') to turn the ions back into atoms.
The negatively charged non-metal ions will be attracted to the positive electrode and lose electrons to become atoms again (the ions have been 'oxidised')