I gather from your other threads that you are planning to walk from SJPP in May. This will be one of the busiest months of the year. I'd suggest booking your first night in SJPP. I haven't walked at that time of year, but have followed the reports here on the forum quite closely.
Sometimes people find themselves in a crowd as they walk across the country and caught up in a bed race, so they find it better to book ahead. On the other hand, some people others find themselves in albergues with empty beds only a week after a crowd has passed through. More people start walking in the major centres on weekends, so that might account for some of the peaks and troughs in traffic.
If I were going in May, I would probably book in advance up to and including Pamplona, as it is not so hard to predict the first 3 walking days. Then I would play it by ear. I would have a smart phone with Spanish SIM card and some data and talk time, and I'd have a couple of booking apps/sites on my phone that I am familiar with. I would book something in Santiago at least a week before I get there. If I knew for sure when my last day would be (say, because of a flight out) I would even book that in advance of travelling.
If you arrive in a city that receives lots of visitors, on a weekend during high season, you can expect to spend more time and money before you find suitable accommodation. For example, Burgos and Leon.
Since you are also not sure of your walking itinerary, given your questions about walking long daily distances and jumping ahead to make up time, it is probable that reserving only a few days before would be appropriate.