Generally you tip when someone provides you with a service, and especially when they've gone above and beyond the base "experience".
A cashier isn't really providing a service... they're collecting money for the store.
Baggers, however, provide a service, especially if they walk the bags to your car. Servers in restaurants provide a service, as they are in charge of your dining experience. Handymen that fix things in your house provide a service, etc.
In theory, you tip because you got an excellent experience. The chance of a good tip is, in theory, what motivates service providers to go above and beyond the bare minimum. If it's a repeated service (like you dine at your favorite restaurant often), and the service provider knows you tip well for good experiences, it provides a good incentive to keep providing excellent experiences.
By paying a "fair" wage to the server, you do remove some problems, but you may introduce others.
When I was younger and worked as a server, it was commonplace for fellow servers to end the night with $150-$200 in tips (in addition to minimum wage, as this was California), which is decidedly above a "fair" wage for maybe 4-5 hours of work. It was a bad night if you didn't break $100 in tips. Changing to a salary system, for some, would mean a net pay decrease (or far more expensive food, which may decrease patronage).
In addition, many feel a salary system would remove any incentive to deliver excellent experiences above the bare minimum. If you're a server, and you know no matter what happens on the floor tonight, you get paid exactly the same... perhaps you don't refill drinks quite as often... or you don't put on your best friendly face when taking orders... because it doesn't matter (think of your Fast Food experiences, where employees don't really care about quality in any regard, food, service, cleanliness, etc). We worked hard for those tips, because it produced immediate, tangible results.
I know this is partly anecdotal, but for me back then as a server, I prefer tips over salary.
I can choose to tip nothing as a "fuck you" for bad service.
In fact, I actually once deducted 18% from a bill I got at a restaurant where the service was so poor, we had to carry our own drinks and food from the kitchen to where we were sitting.
I left a note and explained that I was tipping myself for that experience and left 18% less than the bill was.
That actually worked and the service we have had from them since has been stellar!
Sometimes I change my mind about where I'm going and take a totally different trip than planned - and when I like the driver or make them go out of their way, like say "I'm going to make several stops" and they aren't expecting that, then I sometimes tip them.
However, when they fuck up my route, like for example me telling a driver I was going to alameda and he gets off the freeway in San Francisco instead of going across the bridge as to be expected and wastes my time, I complain to support@uber and request a refund.
Uber support has actually been quite good for me. I recently was mistakenly charged three times for one ride, and they fixed it very quickly.
AirBNB on the other hand has horrid support from my experience.