In Viljandi, public transport is provided on city buses.
You can buy single tickets from the buses (from driver for 1 EUR), Estonian Post offices (Paalalinna Maksimarket, Männimäe Selver) and MTG Viljandi office (Pargi 5B, Viljandi). Be sure to stamp your ticket on board or you risk a hefty fine if an inspector catches you. Other options sold in Estonian Post offices include 30-day ticket for 17 EUR (valid during the dates stamped on the ticket).
Bus schedule information can be found at: peatus.ee/en. This webpage helps you to navigate public transportation network efficiently. You can also check timetables for all bus stops and bus lines.
For transportation headed out of Viljandi, check the bus timetables and prices: www.tpilet.ee or train timetables and prices: www.elron.ee (you can buy tickets online)