The thing to keep in mind is that this isn't a ritualized situation, such as the 只今{ただいま}/お帰{かえ}り
, "I'm back" / "welcome back", call and response pattern. When you come and go from the office or home, there are set patterns. This restaurant situation isn't like that.
Specific to your questions, there is no usual exchange between customer and cashier when paying for an item, or when a waiter brings you your food. Most Japanese I observe seem almost as if they don't acknowledge the existence of the staff and say nothing. However, some kind of nod or word would be perfectly acceptable if you wanted to do it.
On the way out, there is nothing at all wrong with thanking wait staff at restaurants. The worst that can happen is that they think you're a little unnecessarily polite, and that ain't a bad thing, is it? The words just mean what the words mean, and you can use them as you see fit, in order to represent yourself as you would prefer. Let's look at the implications:
As pointed out, you do not have to say ありがとう
as you are a customer paying for a service. But you could, and it won't even raise eyebrows. You could say どうも
. It's not inappropriate, but it is casual. Imagine, in English, at a restaurant saying, "hey, thanks man!" to the waiter as you leave. Does it fit the environment? You make the call.
Another one not mentioned so far that you'll often hear at casual restaurants, particularly at 回転寿司{かいてんずし}
, rotating sushi places, is お愛想{あいそう}
or お愛想{あいそ}
which are both ways of saying "bill please".
美味{おい}しかった
, "that was delicious", isn't a statement of gratitude for the service, it's a comment on the food. Say it if you actually think the food was good. What restaurant doesn't want to hear that the food was delicious?
Lastly, you can just take care of proceedings by asking for the bill by calling out お会計下{かいけいくだ}さい
, "bill please", or お勘定下{かんじょうくだ}さい
, "check please", or variants (you could drop the お
and/or the ください
) , without saying any kind of gratitude statement. Just keep it about the business, and no one will mind.
My bonus cultural observation: The Japanese concept of service is that it's not about the people. The person working at a store or restaurant becomes entirely a representative of that place while on duty, and they check their individual personality at the door. So for the customer, the staff does not merit personal interaction the way other people do.
To a non-Japanese mind, it seems a little harsh, as in other cultures, like mine, we tend to think about the person doing the job. I tend to sympathize with the guy doing the minimum wage job. However, in Japanese culture, it's not an attempt to be superior to the service staff, it's an acknowledgement that the service staff are also not necessarily personally invested in the job.
In some ways, there is a certain liberation in the concept, because the staff can also detach themselves from the job so as not to take issues personally.
Hope that helps.