In South Korea, when you eat at a cheap eating establishment (in "cheap" I mean such establishments where one menu costs about 5,000 KRW to 12,000 KRW and usually in a bit old establishment) and finished the payment, it is usually the case that you and a waiter exchange "안녕하세요~" just before you leave the restaurant.
Usually, when I first say 안녕하세요, the waiter responds not by "안녕하세요~" but by "네~~~ 안녕하세요~".
So, I feel that it is not correct to just respond by "안녕하세요"; if the opponent said it first, you must follow it with "네~~~" (stretch the end out a bit).
Is my guess correct here? If you are greeted "안녕하세요" before you issue it, is it impolite or otherwise inappropriate to just return "안녕하세요"? Also, does this vary by the relationship with the two (e.g. younger vs elderly)?