1. You set, in your client options, the fee you will include with your transaction. This fee goes to whichever miner includes that transaction in a block.
2. Miners set, in their mining software, the policy for which transactions to include in their blocks. They can set a minimum fee per transaction, or a minimum total fee per block, or whatever they want.
3. The market takes its course. If your offered fee is quite high, the transaction will probably be included in the very next block. If it's typical, it still might be, but if the network is very busy you'll have to wait in line with everyone else. If it's very low, you may wait a long time for one of the few permissive miners to finally generate a block with your transaction in it.