I was in Rojales, Alicante last weekend where lots of the caves have been turned into craft workshops. Yesterday I was in Guadix, Granada where there are supposed to be over 2,000 caves used as homes. Indeed in the museum there, dedicated to cave dwelling, to troglodytism, there was an information board to say that in 2002 there were 5,838 caves in Granada province which were the principal home for just short of 15,000 people.
It's not a complicated idea. You find some rock that's easy to dig. Usually that's clay. You start with a vertical cut to produce the façade of the house. In the centre of that façade you cut the arched door and from that door you excavate the first room generally with a square base and a vaulted roof and then work backwards into the hillside cutting galleries and rooms. The work is done with picks and shovels. The actual distribution of the rooms depends on how much money you have to pay the people who dig the galleries and rooms but also on the general topography of the land. The expert digger has the experience to determine the best shape.
Normally the principal rooms are towards the front of the house and the less used rooms at the back. Natural light is only available to the rooms that are close to the façade so people try to have the façade south facing so as to get as much natural light as possible. The general wisdom is that caves maintain an even temperature which is warm in the winter and cool in the summer. The average temperature inside depends a bit on how deep the caves are dug but generally they maintain the average air temperature of the region from summer to winter. In most of Spain that means the inside temperature hovers between 17ºC and 23ºC without any marked seasonal change. Humidity is around a very healthy 50% though damp seems to be a problem in lots of the caves I've been in.
Many of the caves are given a frontage of more typical building materials and sometimes, in the style of building a conservatory onto your house, an extension is built away from the rock face to give some extra room.
It can be quite odd sometimes, driving around Spain, to see a chimney sprouting out of the ground and to realise that someone is living below ground as people have done for thousands of years.