It can be confusing in the US because almost every point of sale system asks for a tip now. As a general rule, if you are paying before you consume your food then no tip is required. If you are paying after you have been served and eaten, then a tip is socially expected: 10% for "poor" service, 15% for average, and 20%+ for exceptional service. Not tipping is also an option, but largely considered "A Dick Move" by most people. If your transaction does not involve eating a meal then tipping should not be part of the transaction.
There are of course exceptions and edge cases, but this should cover you 97% of the time.