get the most appropriate ticket purchase a ticket in advance online pay the right fair to the on-board staff collect the ticket from the ticket selling machine
When you start from a station with no ticketing service. When the tickets are all sold out in the booking office. When you travel in a group of ten or more people. When you travel on a train with sufficient seats.