There are a lot of theories that attempt to explain how Westerns came to leave their churches in great numbers. Some focus on ideas, particularly the idea that believing in God made no sense because the evidence for the existence of God is (so it's said) very thin. Proponents of this theory believe that once religious people reasoned their way to irreligion.
According to Mary Eberstadt, reason may account for some "secularization," but hardly accounts for very much of it. In How the West Really Lost God: A New Theory of Secularization (Templeton Press, 2013), she proposes that Westerns "lost God" because the families in which they lived–the main transmission belts for religious beliefs–were transformed by other factors (urbanization, industrialization, etc.). As families became smaller and more fragmented, they ceased to transmit religious beliefs and habits to their younger members. Listen in to this fascinating interview.