Chuck Wight, a chemistry professor at the University of Utah, provides the following explanation:
A typical water-softening system removes calcium and magnesium ions from hard water and replaces them with sodium ions. Calcium and magnesium ions interfere with the action of household soaps and detergents, but sodium does not. The water-softening process thus helps detergents to more effectively remove dirt and oils from clothing and dishes. It also helps soaps to give a "slippery" feel to your skin when you wash. Most manufacturers of water softeners recommend that you reduce the amount of soap and detergents you use after installing a water softener.
The water softener unit is located in your household plumbing near the place where water enters the house so that it softens the water used for drinking and washing but not for irrigation. The unit contains several cubic feet of porous plastic resin covered with molecules that attract and bind to positive ions dissolved in the water. Normally, sodium positive ions coat the resin, but as water flows over the resin on its way to your sink or washer, the naturally occurring calcium and magnesium positive ions that exist in hard water stick to the resin. This releases sodium ions into the water in order to maintain a balance of electrical charge on the resin. Gradually, most of the sodium ions are released into the household water, and the resin becomes saturated with calcium and magnesium ions. Every few days, the unit must renew the resin by rinsing it with a concentrated solution of saltwater (sodium chloride), usually in the middle of the night. The high concentration of sodium ions in the salty water displaces the calcium and magnesium ions the resin, and the resin becomes once again covered with sodium ions. The salty rinse water, calcium and magnesium ions are flushed down the drain, and the system resumes normal operation. (Every so often it is necessary to add a bag of sodium chloride salt to the softener unit to prepare this salty rinse water.)
Each cubic foot of resin can effectively remove calcium and magnesium from about 3,200 gallons of hard water, which the Water Quality Association defines as 10 grains per gallon hardness. The process adds about 750 milligrams of sodium to each gallon of water, which the U.S. Food and Drug Administration considers to be in the "low sodium" range for commercially sold beverages. For people who are concerned about their overall intake of sodium, resins that instead release potassium into the water do exist, but the potassium chloride salt used to renew the resin every few days is more expensive than ordinary sodium chloride salt.