Traffic law applies to foreigners exactly as it does to locals, cycling included, and ignorance of local rules is never accepted as a defense, so a short read of the country's road rules is worth the effort if you plan to ride. Helmet mandates vary: some countries require them for everyone, more require them only for children, and many have no bicycle helmet law for adults at all, though e-bikes and e-scooters frequently carry stricter rules than pedal bikes.
Beyond helmets, the rules that actually generate fines for visiting cyclists are the unglamorous ones: riding on sidewalks where prohibited, ignoring bicycle-specific traffic signals, riding against one-way streets without a marked contraflow lane, no lights after dark, which is enforced surprisingly widely, carrying a passenger, and cycling under the influence, which is a real offense in many countries. Where bike lanes exist, using them can be compulsory rather than optional.
Fines are typically on-the-spot and modest, but an accident while breaking a rule can complicate insurance badly. Rental shops and share apps summarize local requirements at handover, and the national road authority page is the definitive source. Lights, bell, sensible lane use, and a helmet will keep you clear of virtually all of it.