Water wells are an important water source, especially in areas which experience a serious dry season and don't have other sources of water.
The ground may act as a filter, providing high quality groundwater. In other cases, the water may be polluted by industrial waste, or contaminated due to poor placement relative to a septic tank, or brackish due to saltwater incursion.
Any form of latrine or septic tank should be placed at a safe distance, to minimize contamination of the water supply. In theory this will depend on the local conditions - soil, fissures in rock, depth of the well. In practice, a distance of 10 m is often used as a safe rule of thumb.
A form of well is also used to collect rainwater - this must be surrounded by a collection area which funnels water into the well. This performs groundwater recharge, and the same well may be used to collect water.
Digging water wells
The digging of water wells is a science on itself. Parameters to determine correct placement include looking at the landscape, humidity of the soil, geology, and the trees growing in the area. More info can probably be attained with Pat Forage International (in particular through Gérard Roso)