Public Airport Transportation:
The MBTA Blue Line and Silver Line go to Logan. The Silver Line is a low-floor articulated bus that stops at each terminal every 10 to 15 minutes, from 6AM to 12:45AM every day (5:35AM start M-Sa). From the airport, the bus travels along the South Boston waterfront and terminates at South Station. Convenient transfers are available to the Red Line, south-side commuter rail trains, and southwesterly Amtrak trains. Tickets are $2, and can be purchased in each airport terminal.
To get to/from the Blue Line Airport station from the airport itself, you need to take a free Massport shuttle (check the signs outside the terminals to see which ones to take). As with the Silver Line, tickets are $2: tickets can be purchased using the machines at the station. The last Blue Line train leaves Airport station shortly after about 12:30AM. Unless your final destination is a Red Line subway stop, this is the easiest way to get into the city. To connect to the Red Line, use the Silver Line instead.
Private Airport Transportation:
Taxis are more expensive than in many other cities. Fortunately, the airport is very near the city so the fare is not extremely expensive. It would be about $25 for fares to Boston, and less if you are staying downtown in the financial district. If you're not driving or being picked up, you'll need to take a taxi if you are at the airport when the T is not running.