Tipping varies extensively among cultures. Though by definition a tip is never legally required, and its amount is at the discretion of the patron, for travellers it can cause some serious dilemmas.
In some circumstances, failing to give an adequate tip when one is expected to is a serious faux pas, and may be considered very miserly, a violation of etiquette, or unethical. In some other cultures or situations, giving a tip is not expected and offering one would be considered at best odd and at worst condescending or demeaning. In some cultures it might be seen as a bribe, and in some circumstances (for example tipping government workers), tipping can even be illegal and prosecutable as a serious crime.
In countries where tipping is not customary, attitudes towards the practice can differ. For instance, in Hong Kong or Australia, while tipping is generally not practiced by the locals and not expected, it is still welcome by service staff should you decide to do so. On the other hand, in Japan and South Korea, tipping is seen as an insult, and attempts to do so could offend your server. Additionally, in many places (Russia is one), foreigners who are perceived to be from countries where tipping is widespread (such as the U.S. or Canada) may be expected to tip even if locals aren't, and they may even encounter hostility if they fail to do so. In Malaysia and Singapore, hotels and restaurants may include a 10% "service charge" before tax in the bill that one is expected to pay, but otherwise tipping is neither customary nor expected.
In countries where tipping is expected, complicated unofficial standards and customs have developed over the exact percentage to tip, and what should and should not be included in this calculation. In other countries and cultures the topic is way more relaxed.
It is not easy for the traveler to know what to expect when they go to a foreign country—sometimes the rules are so arcane even locals have a hard time keeping it all straight. While in some cases you as a visitor from a foreign country might be given a certain limited degree of leeway, no one—especially in countries where the law allows employers to pay tip-earning workers lower wages—has complete carte blanche to ignore the rules. It therefore behooves overseas tourists to learn at least the basics of tipping custom in the country they are visiting. (Conversely, if you're a foreigner in a tip-expectant country, you can even work the system to your advantage: locals might assume foreigners will tip less than they should, and if you surprise them by tipping appropriately you may get even better service than a local would get by giving the same amount!)
In most countries, service personnel get paid enough to live on and thus do not have to rely on tips. While intentions are clearly good, tourists from some places (North America especially) are sometimes not aware of this—or they may simply feel bad not tipping—and they export their generous behavior to other countries where tipping is traditionally not customary. Of course, this is quickly accepted (how would you react if someone gave you extra money?) and creates expectations that did not exist before. In some places, this may also lead to the phenomenon of American tourists getting shoddier service than locals, because it's assumed they'll leave a tip regardless.
If you are tipping in a foreign country, it's best to think in terms of what the amount means for the recipient, rather than how much (or how little) it is for you. In some countries, people occasionally get tipped a month's salary in one go. While this definitely is cool for them, it can cause serious trouble. Think about a waiter earning more than the chief of police...
Another problem is that, even if tipping was originally intended to improve service, some employers use it to underpay workers with the expectation that tips will make up the difference. A prototypical example is the American restaurant industry, where the "service wage" can amount to as little as one-quarter of the minimum wage in other sectors of the economy, as well as places like Namibia where it's common practice even at government-owned facilities. There is no guarantee the recipient even gets to keep the money; some employers may split tip revenue between large groups of workers (as a pretext to pay a lower wage to all of them) or, where legal safeguards are weak, even pocket a significant percentage for themselves. In Canada and the United States, the restaurant industry has a distorted tipping distribution arrangement in which servers get the majority of all of the tips and the remainder of workers such a the cooking staff get a flat rate, resulting in low compensation for cooking staff, while servers in higher end restaurants often make far more in earnings than anyone else at restaurant.
Use of tipping as a de-facto commission on sales in restaurants, with a corresponding reduction in workers' base pay, has unpredictable impacts on how much servers get paid. On a slow night, servers make little or may even be sent home early. Conversely, tipped servers in an overpriced establishment in a busy location stand to profit more with a palm outstretched for gratuities than if they were simply making an honest, predictable fixed wage. These wide variances have little to do with the quality of the service offered, but serve as a means for the restaurateur to shift commercial risks (of wage costs which would otherwise be incurred even when business is slow) onto the workers.
Tipping is also an end-run to avoid taxes, which may be another reason for tips spreading into previously tip-free areas. While there often are technical rules that make income from tips subject to the same taxes as other income, it is hardly if ever reported and thus tips are most often de facto tax-free (especially if given in cash). Exceptions include the United States, where the federal Internal Revenue Service assumes that all waitstaff receive tips and penalizes those who fail to report any; even so, it's very much the rule rather than the exception for U.S. restaurant workers to deliberately underestimate their cash-tip earnings and pocket the (often substantial) difference tax-free.
In countries where tipping is widespread, a restaurateur who quotes an inclusive price (with the various sales taxes and a fair wage for the workers already reflected) would be placing themselves at a severe competitive disadvantage. Their rivals would appear to be cheaper by quoting a moderate initial price, then raising that price to add taxes later (at up to 15% in some jurisdictions), then soliciting tips (which can add another 15% or more). At the individual establishment level, any experiments in all-inclusive pricing will therefore be ill-fated and short-lived.