The urban bus network is comprehensive but fairly complicated. There are information booths in the Plaza de Cibeles and Puerta del Sol, which dispense a huge route map (plano de los transportes de Madrid), and sell bus passes. You can also buy tickets at tobacco stands (estancos). Fares are the same as for the metro, at €1.00 a journey, or €6.5 for a ten-trip ticket (bono de diez viajes) which can be used on both forms of transport. Just like the metro, when you get on a bus, you punch your ticket in a machine by the driver.
Buses run from 6am to 11:30. In reaction to an unofficial call to run the metro 24 hours a day, there has been a significant expansion to almost thirty all-night (búho) lines around the central area: departures are half-hourly 12.30am-2am, hourly 2-6am, all from Plaza de Cibeles.
Save time and frustration - always buy the 10 trip ticket (bono de diez viajes). You'll find yourself needing one when there isn't an estanco nearby and more than one person can use the ticket, if you travel together.