It is possible to get from your hotel to the train station by public bus. However, it would include walking to the bus stop, waiting, and also a change in buses mid-way through the route. If you have luggage, that will be very inconvenient. I suggest you call for a cab. Tel# 923-250-000. I'm sure the hotel could assist you. Maybe 5-10 euros.
However, the Train does not go to the Barajas airport. It will stop (most likely) at the Chamartin train station. So you would need to take another cab to the airport, located outside of the city. Probably a minimum of 25 euros. So my suggestion is to take the bus from Salamanca instead of the train. Check the schedules at www.avanzabus.com. You didnt say when you were traveling, but this summer they started routes that from Salamanca directly to the Barajas airport. That saved time and money.