A ticket purchased from the driver (at the price of €2.00) will grant you the right for one ride. Tallinn public transport ticket information and fares are published on their website, you can also easily check schedules of public transport by vehicle/stops. For international students who have registered their place of stay as Tallinn (City District Government Office) and acquired a smartcard for transport, public transportation is free of charge.
There are also bicycles and electric scooters (Uber, Bolt and Tuul) available for rent throughout Tallinn city centre and areas around it. To use the scooters or bikes, just download the corresponding app, scan the scooter/bike and start riding. Make sure you check the map in the app to make sure where you can leave the bike/scooter.
Central Tallinn is very compact and easy to get around, and reaching farther out destinations is simple thanks to the city's network of buses, trolleys and trams.
The public transport network operates from 6:00 to 23:00 (some lines until 24:00). The ticket system works on a random-inspection basis, so you can board via any door and don't have to show anything to the driver. You must, however, have a validated ticket what you can buy from the bus or you risk a €40 fine. Some riders are entitled to use the system for free: children under school age (under 7), an adult travelling with a child under 3 years of age, registered Tallinn residents (using a personalised Smartcard and carrying ID).
More information you will find here about the public transportation: https://www.tallinn.ee/en/pilet/how-buy-ticket