The quality and availability of drinking water vary between countries and regions. As a general rule, clean water is more difficult to get in hot weather, at low-income destinations and outside settlements.
Tap water is often provided by the local government and treated to be at least relatively healthy for the local population. This may include filtering and adding chemicals. Tap water sourced from mountain springs and rivers may require little treatment and be exceptionally high quality. However, water quality varies greatly between regions, and there are many countries where tap water, or at least unboiled tap water that hasn't gone through a reverse-osmosis filter, is dangerous to drink and can make you sick. One basic rule is to look at what the locals do: If they do not drink the tap water or do so only after boiling it, you should not drink water directly from the tap either.
Your body is accustomed to the water from your local environment. If you travel to a region with poor water quality from another with high water quality (or with different pathogens), then you may suffer from illness. Your body may adapt over time, but some water sources are so contaminated that it is unsafe to use them, lest you become infested with parasites or suffer other consequences.
Drinking the water is not the only hazard!
If you rinse your toothbrush in tap water, or have a drink with ice cubes, or order a nice leafy salad in a restaurant that washes vegetables in tap water, then you may be exposed to whatever nasties are in the water.
For more information on afflictions that can come from contaminated water, see the Infectious diseases#Enteric illnessesEnteric illnesses article.
For more information on prevention and treatment of diarrhea, see the Travellers' diarrhea article.
Short-term ill effects of drinking water are usually down to contamination by bacteria. Boiling and filtering can mitigate the danger of illness, although toxins produced by some bacteria may remain despite the bacteria themselves being gone after the treatment. Another method that will kill most pathogens is UV radiation. In a pinch putting a clear bottle of water into the direct sunlight for a day or two will get it as close to drinkable as boiling would. However, this is definitely not the safest way to purify water, as other pathogens such as amoebas are not killed by UV.
Cyanobacteria in big concentrations ("algal bloom") can make water unhealthy to consume and irritating for the skin. This is mainly a problem at some beaches, usually not a real hazard unless you have children or pets.
In some countries, water supplies are prone to contamination by chemicals from industrial and agricultural sources. Although drinking such contaminated water is not recommended, it will generally not cause any immediate health issues if the contamination is at relatively low levels. If you drink such water over an extended period of time then long term health issues may arise. Note that water filters are unlikely to remove any of these chemicals. Another contaminant that can even occur in high income nations is lead. Plumbing used to be made from lead (plumbum in Latin) and some houses may still have lead tubes on the last few meters. This is usually no problem and those are increasingly being replaced, but if the chemical composition of the water changes, lead can leach into the water. Young children are especially susceptible to the health effects of lead exposure. The only way to be 100% sure is to regularly check water at the tap and to remove all lead plumbing.
According to a 2014 infographic based on the United States CDC's recommendations, tap water is safe to drink in most of the EU and Western Europe, the United States, Canada, Greenland, Australia, New Zealand and a handful of Asian countries — elsewhere it isn't. This is a conservative recommendation, and there are many other countries with tap water that's potable, though in some it may upset your stomach at first while your body gets used to the local microbes and minerals.
For country-by-country information, see the "Stay healthy" section of each country article.
You may hear locals refer to "hard/soft" water. The "hardness" of the water is determined by its mineral content, and there are stark regional variations owing to the various soils and rocks that water filters through before it reaches the mains supply. Water from different regions will likely vary in taste.
"Hard" water is not unhealthy to drink, but it can cause limescale build-up in appliances such as kettles and dishwashers, and require more detergent for dishes and laundry.
The ancient Romans preferred "hard" water, the evidence of which are the limescale deposits in erstwhile aqueducts that in some cases were large enough to be used by medieval masons for figurines.
One sometimes wants to have hot (near-boiling) drinking water, e.g. to make a cup of tea or other beverage. Availability of hot water at typical places of lodging and transportation varies around the world; it somewhat correlates with the nation's proclivity for tea-drinking.
If you find yourself somewhere where a trustworthy supply of water does not exist, you can:
There are different ways of purifying water, some more effective against specific threats. In some areas boiling water for a minute is enough, in others several minutes are needed. Filters vary in effectiveness, and should you have a concern, then you should consider buying your water in a sealed bottle from a reputable company.
Boiling the water or using iodine kills organisms but does not make chemically polluted water safe. You are unlikely to suffer in the short term from mildly chemically polluted water, but drinking it over an extended period could be harmful to your long-term health.
Remember that polluted water can affect your health without your drinking it directly, such as if the water is used for washing vegetables or brushing teeth. See Precautions against disease in the Stay healthy article.
Even in areas that normally have safe drinking water, flooding and other incidents of contamination can take place. Anyplace with decent news and/or public health announcement coverage and a reasonably responsible attitude on the part of relevant authorities is likely to give warnings at times when it's necessary to boil or completely avoid drinking water that comes from sources that are safe under normal conditions.