I would avoid the summer. It gets very hot. And a lot of places don't have A/C there. As for how much time to spend there, that's up to what you're into. Madrid is a very big city with the typical city attractions. Fantastic world-class art museums if you're into that. The Reina Sofia is...