This article is from the Water for coffee FAQ, by Jim Schulman with numerous contributions by others.
Distillation removes all water impurities, good or bad.
Nowadays, one can buy 1 liter per hour countertop distrillers, but
otherwise the much more efficient reverse osmosis process is used. In
reverse osmosis, some water is forced through a membrane impermiable
to minerals which are washed away by the proportion of water not
passing the membrane. RO should produce virtually pure water (below 1
mg/l total solids); however, mineral removal is compromised when the
amount of waste water is reduced. For instance, supermarket RO
vendomats in very hard water areas may put out as much as 50 mg/l
hardness and alkalinity levels. Home reverse osmosis systems are
generally self-cleaning, but need to be installed and set up by
specialists. They are more expensive to buy and operate than ion
exchange softeners (see below).