Bus tickets versus passes
If you travel a lot, you'll be better off with a rail pass than with regular tickets. Most of these passes are actually "public transport passes" and also cover buses. Some cover buses for free, so you don't need a ticket. Other passes offer a discount, so you need to purchase a discounted bus ticket.
Where to buy tickets?
If you don't have a pass for unlimited traveling, you will need to buy a ticket. In most cases you are supposed to buy a ticket before you board the bus. You can do so from the ticketing machine, a ticket office at a train or bus station, or online through the timetable. Some buses have an on-board ticketing machine. In such cases the driver does not sell or even check tickets. Tickets will be checked randomly by other staff. Buses operating like this are labelled with a yellow icon in the shape of an eye.
In rural areas without machines and ticket offices, you can buy a ticket from the driver.