As a tourist in Japan, you are able to shop a lot of goods Tax-Free, meaning you can get it for a cheaper price than residents of Japan.
There are two different types of Tax-Free shopping procedures, the procedure depends on the store. The first one is to present your passport during the payment, at this moment they will deduct the tax from the price already. The second one is to pay the full price, including tax, and head to the tax-free counter on the day of purpose. Then you will have to show your passport and receipt here and you will get a refund of the tax.
You will have to sign a receipt, as a proof you got the products tax-free. The cashier will staple the receipt in your passport. You are not allowed to remove this yourself.

At the airport, while leaving Japan, the customs officials will confirm your passport and the goods that you have bought tax-free. Officially, you need to carry the tax-free products on the receipts with you, since there is a chance they might check it. After they have confirmed the passport and the goods, they will take the receipt out of your passport and you will be able to leave the country again.