I just stayed "out there" by Barajas as a solo female. First time I'd stayed near Barajas, but not my first time in Madrid. Although my hotel was fine with shuttle options, restaurant, etc., I found the area rather bleak. I didn't mind in the circumstances of my trip - I was ready just to shut down in the late afternoon and wait it out at the hotel - but I think I might do things differently in your situation.
In your situation, I would probably stay in Madrid. That might be more pleasant with options to extend your evening close to your hotel if you felt comfortable being out alone. (9 PM is my self-imposed curfew, also)
Considering options for getting back to Barajas the next morning from Madrid - I know I would take a taxi, but others would use public transport. Either option is fine. (depending on when you need to be at Barajas)