One important thing to consider when planning a trip abroad is lodging! Depending on your budget, there are different options that may be right for you. An obvious answer that jumps to mind is a traditional hotel. Below you will find a link to tripadvisor, looking at hotels in Madrid. Being a large city, there are a wide variety of hotels to choose from, ranging from 5 stars to chains. It all depends on your preferences!
https://www.tripadvisor.com/Hotels-g187514-Madrid-Hotels.html
Another option is Airbnb, which can be significantly cheaper than a traditional hotel. Some listings in Madrid start at as little as $18 per night! Compare this to traditional American hotels, where a cheap stay can cost even upwards of $70. Below will be a link for MadrileƱo Airbnb options.
https://www.airbnb.com/madrid-spain/stays
Another option that fewer people take advantage of is workaway.com. This website allows you to meet a family looking to provide room and board in exchange for you doing some work for them on a regular basis. This can be a great way to meet some truly incredible people while also covering expenses for living that otherwise might make a trip abroad unfeasible.
https://www.workaway.info/en/hostlist/europe/es?region=madrid
Madrid is such unique and wonderful place to visit that you would be remiss to not take a look at these options for lodging while travelling abroad.