Electrolysis happens by sending electricity through saltwater (sodium chloride, or NaCl), which interacts with the chloride ion in the salt. This creates chlorine in the water, and a very high-pH byproduct called sodium Hydroxide. The now-chlorinated water flows into the pool, and voila!