Going out in Madrid is a real pleasure, with literally hundreds of bars and clubs vying for your attention around the city. Malasana is one of the main areas to go out in, with a multitude of bars catering mainly for the younger crowds, while Calle Huertas is more traditionally Spanish. Chueca is the gay district, and has plenty of fashionable bars to visit.
Going out tends to mean dressing up, and while not many clubs have a specific dress code, it pays to look reasonably good so that you do not feel out of place. Pacha and Serrano 41 are well known clubs, while many of Madrid's wealthy elite head for the fashionable Marmara club in Calle Padre Damian.