Here are some of the best areas to stay in Madrid for nightlife
Very bohemian, pop music, Spanish music of the 80´s and 90´s, relaxed atmosphere, casual clothes. Pubs and bars and some discos. Expect people to be hipster and have tattoos and piercings. Very nice neighborhood if this is your style. Possibly for people in their late 20´s and 30´s. I love this area. It is usually called Malasaña by the people who go there very frequently. If it is not your style, you might find it ugly and not very appealing.
Nice area to start having some cheap beer/tapas, dinner and then finish in night bars dancing. Many options if you want to try different music styles. Usually, the music is trendy and made for people who want to dance all night long.
Cava Alta/Cava Baja in La Latina is where you can find many restaurants and tapas bars. Many different options for different tastes. You can continue the night in night bars and dance all night long. One of the most crowded areas. Depending on which bar you will end up the etiquette can vary. Not too formal, though.
Serrano and Goya area
If you are definitely looking for a very fancy place with people dressed in their most expensive shoes, go to Serrano and Goya area. Anything around this area is more expensive and classy than anywhere else.
Finally, remember that you can move around in taxi or night buses, so you can easily start in one area and move to another one. Your nightlife is not limited by the area you stay. There are many different types of bars in every area. Pubs, discos, after-hours, so you can tailor make your night as you like it.
La Latina, Malasaña, Chueca, Huertas, Alonso Martinez, San Bernardo and Bernabeu Stadium area (this one is in the financial area) are all known for their nightlife.
It really depends on who you are, and what you like obviously. If you like a bohemian and alternative style, you are going to love Malasaña. It is a district full of modern and different places, lots of young people, and cool bars. There are many options in Malasaña, just filter for Malasaña in Booking.com
If you want to find a more touristic place, I recommend Huertas There are lots of bars around the area where you are going to find more tourists, and foreign students
Chueca is a LGTB friendly area. A fun place to go, lots of cool bars, and pubs.
In Calle Serrano you will find a “fancier” kind of clubs, and bars. A more expensive option.
Argüelles, Moncloa, and Ciudad Universitaria are the places to go if you are a university student.