If you are looking for accommodation in Madrid for a few months or longer the box below will help you find it.
Most of the online sites for apartment booking such as airbnb, holiday lettings, wimdu, booking.com, niumba, only apartments etc specialise in short stay bookings of less than 2 weeks. However the apartments search system below from Spotahome is based on people renting their apartments in Madrid for more than a month or medium to long term.
Places close to the centre of Madrid near to transport links such as the metro are more expensive. Renting houses in Spain is covered by the law and it is a good idea to understand the basic of how the law works see this site.
Remember that the temperature of Madrid in the winter is fairly cold and in July in August it is very hot so you should bear this in mind when you choose a place to stay. For information about Madrid see Ariel's Guide to Madrid written by Ariel after a 6 month stay in Madrid.