Tickets for the fastest trains on the routes between major cities in Spain are specific to the departure date and time you have chosen; when you buy the ticket, you'll get an assigned seat. Those trains often have demand-sensitive pricing. When tickets initially go on sale, some are offered at deep discounts (and often are non-refundable--always check the fare rules for the ticket you are considering). As others buy tickets on those trains, the cheapest tickets get snapped up and only more expensive tickets remain. You can, and should, read about how Spanish trains work here: seat61.com info on trains in Spain. You can see dynamic pricing in action by looking at ticket costs between Barcelona and Madrid (or Valencia-Madrid, etc.) for today and tomorrow vs. for mid-April on www.renfe.com/es/en/.
Not all trains follow that pricing pattern, but the ones that do not, tend to be slower between major cities. I see that there's not much variation in train travel times between Madrid and Caceres, just as one example; the fastest trains don't travel that route. It will be useful to you to identify which of your travel segments will possibly involve trains whose fares will escalate; that way you'll be well positioned to buy those tickets as soon as you are confident of your travel plans. Always click on each fare available for your train and read the cancellation/refund rules.
In addition to the potential for saving money, Spain is a country where the fast trains between major cities do sometimes sell out. You'll see "Full Train" labels when that happens. Unlike in most other European countries, this is not rare. It's not a concern on the slower trains that don't require seat reservations; there's no limit on how many tickets are sold for those.
The Renfe website doesn't always deal well with routes that are not straightforward. It sometimes returns no results for non-direct routes that required the passenger to travel from a provincial city into a hub like Madrid and then back out again. It is then necessary for the passenger to buy the ticket in two segments. If both your origin and destination have train service, there will obviously be a way to take trains between them. There might be an ugly layover somewhere, the trip might take a very long time because of the need to travel into Madrid and back out again, and you will pay for all those extra miles, but the trip will be possible. (In these situations it's smart to see whether there's a more-direct bus option.) Third-party resellers like TheTrainline.com usually handle that sort of situation better, but you'll often pay a bit more either in higher fares or in the form of a ticketing fee, or both.
The pricing of bus tickets doesn't seem to be quite as dynamic as what you'll see (if you look) for train tickets, but bus fares can also escalate as the travel date approaches, and buses can also sell out. It is not a safe assumption that you can always walk into the bus station (or go online) 15 minutes before departure time and get a ticket on the bus you want to take.
Note that even in very small bus stations they stop selling tickets X minutes (maybe 5 minutes? I'm not sure) before departure time. Don't cut it too close!