Following the traditional hospitality of the Camino de Santiago, along the Camino there are many simple refuges where pilgrims are welcomed to stay for free. These refuges do not usually have a lot of amenities, but they have enough of what pilgrims need. There are other public refuges where pilgrims are charged a small fee and which have better facilities. There are also privately-owned refuges which fall under the categories of: hostels, pilgrim refuges, rural houses, hotels, etc. These are private businesses and are all respectable. Some are run by people who love the Camino and treat pilgrims with great respect. Their facilities are usually better. There is a wide range of prices.
You will discover which refuges you like the most. Let experience guide you and do not try to plan everything in advance. If you walk the pilgrimage between May and October you are likely to find the refuges are full. Do not worry because you will always find a spot to sleep. In any case, do not turn into one of those pilgrims that get up early and hurry all day without stopping to look around just to get a bed at the next refuge. If the most important thing for you is to have a bed, do not leave home where you have one for certain. If you go on the Camino, go to enjoy yourself and experience what you find at each step. Fortunate are the pilgrims that, upon arriving to the refuge in the afternoon, find no bed because they surely have enjoyed even more that day of pilgrimage.