In the US, gratuity is often a difficult expectation for foreigners to adjust to. It can cause a lot of misunderstanding and negative feelings when the person tipping and the person being tipped have a different idea of what to expect.
What is a tip or gratuity?
This is an amount of money that goes directly to the person who provided you service instead of to the company or corporation that oversees that service. For instance, if you buy a sandwich at a restaurant for $8.00, that money goes to the restaurant for profit, supplies, operating costs, etc. A very small amount may go to the person who served you, which is often not a sustainable wage. The normal amount for a restaurant waiter to make is about $2.00 per hour, so the majority of their income is sustained by tips they receive from customers.
Therefore, even though tipping is technically "optional", the collective understanding is that everyone should and does tip. Not tipping is perceived as a very negative thing and can upset your service provider because they feel that they have done work for you "for free" or wasted their time that they could have spent serving other people who do tip.
What is a "normal" amount to tip?
Generally, 15-20% is expected, regardless of the quality of service. Tip is not included in the cost of your meal, delivery fees, or service. If your service provider did a really great job or had a very difficult task (e.g. ordering a LOT of food, asking for many detailed changes, or receiving service at a busy time), tipping 25% or more is standard.
Who am I supposed to tip?
Always: Waiters or servers at sit-down restaurants, hair stylists/barbers, beauty technicians, bartenders, delivery drivers, taxi or ride share drivers
Sometimes, or a little less than 20%: baristas (some coffee shops do not give you the option to tip on a card but often have a "tip jar" for you to put a dollar or two into), carry-out food orders
Not necessary: mail delivery service, car service, medical service, or home repairs
Read more on tips about tipping and US Tipping Culture:
"10 Things No One Tells You About Tipping in the US" at EF Language and Culture Blog
"How American Tipping Culture Became So Different from the Rest of the World" by Julia Larson, Vinepair.com