This occurs when hard water enters the softener and passes through resin beads, which exchange the calcium and magnesium for sodium, allowing only softened water to flow out of the system.