It's pretty clever.
Whenever you make a transaction in bitcoin, you point to the previous balance you have from a previous transaction, then you say how much you are sending to what address.
The "fee" is the difference between the amounts.
So if I have 1 Bitcoin, and I send .9 to you, the fee is .1
If you want to make sure you keep some Bitcoin, you just send it to yourself.
So 1 have one, and I send .1 to you, and .8 back to me, the fee is .1
Then when a miner mines a block, any unspent money is now theirs, and they claim it via the address they liked for.