First of all, I guess it’s a good idea to know the ones associated with the different kinds of public transport. So:
трамвай (tramvai) is a tram,
автобус (avtobus) is a bus,
метро (metro) is the subway,
маршрутка (marshrutka) is a commercial minibus,
and остановка (ostanovka) is a stop.
Now, there are a few simple phrases that you should know. When in the city, it is easy to find a route to your desired destination by using an app (such as the ever-popular Yandex.Maps), but if you enter a vehicle and want to check whether it goes there, the easiest way is to ask “Я доеду до (name of the place or stop)?” - “Will I get to ...?”). One good thing about doing so is that the conductor will often remember you and tell you that you’ve arrived.
When attempting to leave the transport, you may find yourself in a situation where the exit is blocked by some other passengers. In this case, you should ask them: “Вы выходите?” (“vi vikhOdite?”, are you getting off now?); and if the person has their headphones on or simply doesn’t respond, just tap them on the shoulder and repeat your question.
Finally, another useful phrase that you should learn is “Передайте за проезд” (“peredaite za proezd”, pass the fare). In a marshrutka, you pay the fare to the driver, and the passengers in the back often ask their fellow riders to pass the money towards the front of the bus. So don’t be surprised if another passenger tries to give you some change.
You can learn more about the specifics of using public transportation in St. Petersburg and learn more general tips here and here.
In case you decide to take a ride on a suburban train or even explore Russia by rail, keep in mind that the Russian word for trains is поезд (poyezd), but suburban trains are usually referred to электричка (elektrichka, electric train). The word for station is станция (stantsiya), or вокзал (vokzal) if it’s a major hub.
On with the topic of suburban trains, keep in mind that their itineraries vary: some may miss specific stops, so always inquire whether they make a stop at your destination. Also, note that if a station has a ticket office (касса, kassa), you are obliged to buy a ticket there and will be fined if you don’t. If there’s none, then you can buy the ticket from a conductor on the train.
Safe travels!