The nightlife in Madrid is the real reason the city is so popular with young people. During the day the city can be a little dry- with all the museums, parks, etc. Most nightlife gets going really late compared to that in the States. Here are a couple recommendations:
Go to a Flamenco dinner show
A Flamenco dinner show is a great cultural nighttime option. If you are traveling to the South of Spain, particularly Granada or Seville, its best to find a Flamenco show in these cities. It will undoubtedly be cheaper and more authentic. However, Flamenco shows in Madrid are still a good option if you wont be traveling outside of the capital.
Try a few tapas bars
A tapas crawl can be fun if you find the right places. Avoid some of the tourist traps in the Sol area, which are overpriced. Ask your hotel for suggestions. Vinoteca, in Plaza Santa Ana, is a one good option.
Check out some of Madrids big night clubs
Madrids night clubs are a fun experience. None card, and as long as you look about 18, you wont have any problems getting in. Try Kapitol, across from metro stop Atocha, and Palacio Real (near Sol). Kapitol claims to be the biggest club...