In May you may still be able to go "seat of your pants" when it comes to reservations. Things don't necessarily kick in until late June-early July. I've been able to find accomodation, even in Segovia, last minute at decent hotels.

I do suggest that you have fixed reservations at your gateway enter-exit cities, and if you're interested in prime locations, that you do what you've apparently already decided: Book ahead in MAD/BCN.

Realize [by researching the cities by name on this site!] the touristy nature of your cities of choice. The only one that shouldn't give you any trouble is Avila, although you may find that fewer lodgings period may translate into possible headaches.

We booked ahead a few years ago in Granada and found lots of availability, staying at the Generalife inside the gardens [recommended] of the Alhambra. Salamanca may work well in May, but check the school calendar...lots of summer school offerings to americanos...

Personally, I like "seat of your pants" reservations. Speaking the language, it allows you to go and find hidden gems [and hidden disasters that make for good campfire stories] to talk about.

Best of luck!
_________________________
Ongi etorri!