(USA) I consider not just the level of the service but also how many total $ my bill was. Some restaurants could be $25 for a two-person meal, and others could be near $50. Usually, the wait staff works just as hard at both. If I tip a flat 15-20%, then the wait staff at the more expensive place gets a higher tip simply because the food is pricier. Thus, I tend to tip 20-25% or more at a less expensive restaurant, 15-20% at a more expensive place, but I also consider the level of service. I try to give the server the benefit of the doubt if the service is poor (could be things beyond his/her control, could be having something bad happening in life that night, etc.) but I can recall at least once the server was so blatantly rude and miserable (we felt very unwelcome) that I gave a $0.01 tip, but that was an extreme case.
I actually hate the tipping system. Sometimes I'd rather the menu prices just include the cost of the service. True for delivery, etc. too.
I will admit, I have never worked a job that collects tips.