Not really an attraction, but one of Madrid's top things to do: the nightlife. This starts late: before midnight, the Madrilenians are still busy with the evening meal or the after-dinner, only then do they find it time to see what's going on in the city.
A good dinner is not a bad start to a night out in Madrid. Around Calle Huertas (from Paseo del Prado to Plaza de Santa Ana) you will find many excellent restaurants. In addition, there are many theatres in this lively nightlife area. you won't be the only tourist here in the summer, far from it.
For alternative entertainment, head to Lavapiés, where you'll find many avant-garde theatres and bars. Watching people stroll by from a terrace is a nice activity in this area. Not far from the Plaza de la Cibeles you'll find trendy cafés and restaurants, along the Paseo de Recoletos and the Paseo del Prado.
There is something going on everywhere in the centre of Madrid: around the Plaza de Santa Bárbara, around the Plaza del Dos de May and also in the districts of Moncloa and Argüelles, where there are cheap places to eat and therefore popular among students.
The formerly impoverished district of Chueca is now one of the most trendy neighbourhoods in the city. The bars in this district are the meeting point for the Madrid LGBTQ+ scene.
In short, there is something for everyone in Madrid. In many places live music is played in special rock cafes and jazz clubs. The idea is to go on into the wee hours, otherwise the locals say you wouldn't really have experienced nightlife in Madrid!
Overview of what's on in Madrid: Official Madrid website