The public transport system in Vienna is well-developed. To give you an overview, it includes suburban trains (S-Bahn,
numbered "S1", "S2", etc.), underground lines (numbered "U1", "U2", etc.), trams
(numbered "1", "2", etc., a few exceptional numberings like "D"), and buses (numbered "1A", "13A", etc.).
A map of all public transport lines, and for
fast connection fast connections only†.
Tickets can be bought from machines at every train/underground station or ordered online in advance. There are tickets for
various possible time ranges, for example:
a single journey (the notion one journey includes changes of lines),
24h, 48h, 72h,
8 days (not necessarily consequtive),
weekly (monday-sunday).
Tickets should be stamped at the beginning of their validity period. Depending on the type of ticket, this period
can be one single journey, one day, one week, etc. Machines (little boxes) to stamp tickets are located
for S-Bahn/underground generally in the hall before getting to the platforms, latest at the platform,
inside trams and buses.
Single tickets can also be bought from machines inside trams and buses (not in S-Bahn or underground trains).
However, unless necessary, this is not recommended (sometimes these machines don't work, sometimes one doesn't have coins, etc.).
Detailed information can be found at the website of the Wiener Linien, see
here (english version available).
This site includes a practical interactive journey planner (click on Plan my journey without filling the fields).