I think tickets to Segovia and some of the tickets to Toledo are priced the same whether you buy then 1 hour ahead or 3 months ahead. It's the longer trips where the savings potential can be significant.
** Always price out round trips; I've seen them actually be a bit cheaper than a one-way, so even if you're not sure when you'll head back from Toledo and Segovia, you might as well make your best guess and opt for the round-trip ticket at no extra cost (if they're still priced that way).
I was able to use the Renfe ticket machines with my US chip-and-signature card. Especially at Atocha Station in Madrid, lines can be long (though more for the long-distance trains than for Toledo and Segovia), so I would arrive plenty early if planning to buy tickets and then travel right way if you especially want to buy from a human being. Also, Atocha is a large and somewhat confusing station. Allow time for finding the right platform. There are often uniformed Renfe employees in the ticket lobby to assist travelers.
Although I have sometimes seen trains for the current or next day marked as sold out when checking schedules to respond to questions on this forum, I don't think it's generally a big issue except for:
- Late trains back from Toledo (Rick warns about this in his guide book)
- Trains around holidays. (How close is your trip to Easter?)
I haven't checked, but Granada to Ronda might be a trip for which a bus would be simpler. The others I think are better by train, though if you should run into a problem getting back from Toledo by train, you may be able to grab a bus. The bus will take longer and drop you off at a place in Madrid that isn't very close to Atocha Station and might well be farther from your hotel, but that would just mean a subway or taxi ride.
Here's the Renfe website for researching schedules and fares: http://www.renfe.com/EN/viajeros/index.html . It's possible you will not find full schedules for at least part of your trip; you may need to check earlier dates. Be sure you're looking at the correct day of the week, and be mindful of Spanish holidays.