Wells are used by dwarves as a source of water for drinking. Dwarves will use the cave or outside rivers for water if no well is available, although they will be happier if one is available. Dwarves will drink alcohol in preference to water: if you brew alcohol faster than your dwarves can drink it, you will never need to build a well.
Dwarves bringing water to others (injured or imprisoned) will not use a well - instead, they will use a bucket and gather water directly from the cave river. This is likely also the case for filling channels.
 Building and destroying wells
Wells can be removed, but they will leave a channel behind.
A well built adjacent to a channel will become a channel for whatever fluid is in the aforementioned channel - if you fill a channel full of lava next to your well, the well will be full of lava as well.
 Using wells
Up to four dwarves at a time can drink from a well by standing above, below, to the left, and to the right of the well. Dwarves can not drink from the well diagonally. If the well is located adjacent to a wall, statue, or other non-passable object, the number of dwarves who can drink from the well at one time may be reduced.
Cave creatures emerge from wells and can ambush dwarves as they arrive for a drink. Wells built near the river will likely anger the frogmen and lizardmen. Wells located near or past the chasm can spawn attacks from ornery chasm creatures. The raids can constitute groups of 3-5 creatures that crawl out of your well(s) to ambush and murder your hapless dwarves. The more wells you have and the closer to the chasm or river, the more frequent these raids will be.
Since wells can invite these unwanted guests, take care in placing and protecting your well. One strategy is to put them in separate 3x3 rooms with a few stonefall traps in the only exit to the room. Falling rocks usually kill monsters with one hit, so these raids are pretty easy to deal with. Putting a trap on each side of the well offers additional protection to any dwarves who happen to be drinking at the time of a raid. Later, you may wish to upgrade to cage traps in order to capture any animals and put them to better use.
██████████. █.^.██████. █^○^^^^^^┼. █.^.██████. ██████████.
As stated above, brewing your own alcohol will greatly reduce attacks from wells.
Another disadvantage to making a well is that the dwarf constructing it will often get stuck on it, much the same as when constructing a statue or window. This is made worse by the fact that removing a well will result in a channel blocking any further construction in that spot. For the greatest success, save before making any well and to make sure your miner has a job to do immediately after making the well. The easier and still fairly good way to free them is to activate the dwarf into the military ( - - ). Then, from the main interface, hit to bring up the squad list, use and to navigate to the squad, move your cursor a few squares away from the statue and hit to station the squad there. Once the dwarf moves away, you can deactivate the squad with the same keys as described above to activate it. However, this does not work all the time.