The city bus service, TPER is an excellent way to get around the city.
Single tickets are €1.50 if purchased on the bus (no change given) for 75 minutes of travel; day tickets are €6 and a city pass, good for 10 trips costs €14. Passes are available in the TPER kiosks around town.
You can buy tickets on the bus with correct change, or from the red ticket machines near the major stops (€1.50, exact change). Validate them in the machines as soon as you board the bus. Board the bus through the front or back doors (the middle door is for descending, although it can be used if the bus is really crowded).
Most of what you want to see in Modena is in walking distance, although the city has trolley and bus lines run by the provincial bus company SETA. Tickets are €1.50 for one zone in the city; purchase on board (bring correct change).
The same company runs suburban buses to surrounding towns, including Maranello if you've come to see the Museo Ferrari.
Image by Steve Morgan, Creative Commons license