I'm not a great teacher but I'll try explain.
Basically, Electrolysis breaks down the compound into its elements.
So if we Potassium Chloride broken down it would make Potassium and Chlorine. The Potassium ions are positively charged so they go to the cathode to gain electrons and become stable and so the equation would be:
2K+ + 2e- (arrow) 2K , this means that two positively charged potassium ions gain two electrions (reason for the plus) to become stable potassium atoms.
The chlorine ion is negatively charge so it is attracted to the anode. The lose electrons to become stable chlorine atoms so the equation is:
2Cl- - 2e- (arrow) Cl2 , this means that two negatively charged chlorine ions lose two electrions (reason for the minus sign) to become stable chlorine atoms.
If you need more help with it just ask, hope I was of any use.