1. You agree up-front in the contract with the car rental company that you will pay for all fines, parking tickets, etc. you might incur during the rental. You agree ahead of time the rental company won't waste any money defending you, arguing you didn't do it, and will instead pay the whole fine immediately and pass it on to you, and payment will be automatically taken. You always agree this because otherwise they just don't rent the car to you.
2. You incur a fine.
3. The authorities fine the owner of the vehicle, which is the rental company.
4. The rental company immediately bills you for the fine, converted to the currency you paid them in, using your payment details, and they add an extra administrative fee as well.
5. The rental company pays themselves and the fine-issuing authority with your money.