I have read a few books about the Spanish civil war and I still can't quite understand how the constitution of 1931 was so liberal. I realize that most people were more leftist but obviously the right still had a lot of power and influence.
obviously the right still had a lot of power and influence
The right did still have a good deal of power and influence in 1931, but they didn't have control. The electoral victory of the left gave them the initiative during the process of creating the constitution, and the right could largely only frustrate and complicate the process. Some concessions were granted to the right to attempt to appease them somewhat, but the left got much of what they wanted. That said, the eventual constitution was a compromise that satisfied very few. The right saw it as an assault on tradition, the Church (Catholic, somewhat obviously), and the economy (both industrial and agricultural). The left largely saw the constitution as not granting enough reform to actually accomplish anything--especially in how the reforms were put into practice haphazardly or not at all.
Paul Preston describes the conflict that came out of the left vs. right struggle as being a "process of polarization and radicalization," and I think this is apt. Any time there was a compromise (which is largely how government works) both the right and left would be annoyed, and moderates would be marginalized and frustrated. Eventually the middle was evacuated, leaving polarized factions that despised their opponents only a little more than they despised their allies.
Does that make sense? As always, followup questions by OP and others are encouraged.