A water softener resin is some sort of medium -- usually a bead -- that attracts magnesium and calcium, the two minerals that make up the majority of hard water, so that the magnesium and calcium binds to the bead.
Water softeners work through a process called ion exchange which eliminates calcium and magnesium from the water. When the hard water enters into the mineral tank, it flows through a bed of spherical resin beads. These plastic beads, usually made from polystyrene, are charged with a sodium ion. The resin beads are anions, meaning they have a negative charge. The calcium and magnesium minerals have a positive charge, making them cautions. Since opposite charges attract, the negative charge of the minerals is attracted to the positive charge of the resin beads. As the hard water passes through the resin, the beads grab ahold of the mineral ions and remove them from the water. When the bead seizes the mineral ion, the sodium ion is released. The column of resin strips all the hardness out of the water as it passes through the mineral tank, and softened water flows out into your home.