I think that many of us from the US come to this issue based on our US experience — airport hotels a mile from the airport, regular shuttle, great for after you drop the rental car off at the airport, etc. We are also shaped by the fact that in the US there is frequently no good public transit option to the city, or if there is, it takes more than an hour to get from the city to the airport.
I know lots of people like staying in Barajas (the town) at Hostal Viky, but for my money, since getting into central Madrid is so cheap and so quick, I would always prefer to stay in Madrid proper rather than at an airport hotel, where the food is likely to be bad, the charm non-existent, and the surrounding area a maze of intersecting highways.
Two years ago, during the height of covid, we had to stop in Madrid overnight on our way home from Lisbon. I reserved an airport hotel for the first time ever, thinking it would be the quickest and the best option for us the next morning. In hindsight I was wrong. The airport shuttle took more than an hour to come pick us up at the airport, and it took us to the dismal place I described above. The next morning, given the hotel shuttle schedule, we had to leave the hotel at the same time we would have had to get on Cercanías from downtown anyway.
It’s certainly up to you where to sleep, but in my experience, the Madrid airport hotel option does not provide the advantages that you may be used to in the US. IMO, it is just not better than going downtown, having a good meal and a nighttime stroll through a beautiful historical core, and then heading out to the airport the next morning.