There are many scientific theories about this. In general, it is a major subject of comparative politics - which is itself one of the major fields of inquiry within political science.
It is not an exaggeration to say that people spend entire lifetimes trying to understand this subject. However, the general body of research you are probably interested in is democratization theory. Rather than referring to primary works, Wikipedia has a long list of social factors that are believed to be important in democratizing.
The causes section is pretty good, but I would not pay much attention to the "views" section, which is overly simplistic and focuses on well-known names, rather than doing a good job of explaining over-all view points.
A past generation of scholars were really invested in modernization theory, which thought that capitalism and democracy went hand-in-hand. I summarized it's main tenets in this answer. Although it's no longer in vogue, it has definitely informed democratization theory. So it's still relevant to understanding the state of research today.