Whole volumes of research have been committed to this question over the centuries and will continue to be committed to this question for as long as people are asking questions about Christianity, probably. In many ways, this is a question so complex that no answer could be sufficient. A few factors can be listed though. Quite simply, the Reformation happened because a group of religious persons - led primarily by Martin Luther but preceded by important figures like John Wycliffe and followed by significant reformers like John Calvin - in the late medieval period became profoundly dissatisfied with the practices of the Roman Catholic Church.
This dissatisfaction had something to do with the humanistic rise of scholarship throughout Europe, with cultural and religious distinctions between northern and southern Europeans, and with the general political instability of the papacy over many years preceding the Reform. Martin Luther was by no means the first dissenter among Roman Catholics. He was perhaps, however, the first significant dissenter whose movement was neither brought back into the Roman fold (like Francis of Assisi's had been earlier) nor was condemned and disciplined permanently out of the fold (like Jan Hus and the Hussites). Lutheranism's and Protestantism's ability to survive as independent dissenting movements surely had as much to do with the political and cultural situation in Europe as with the nature of the reformers dissent regarding the church.
This is not to diminish the theological import of these dissensions, however, among which were included the role faith in salvation, the authority of the Pope, the authority of scripture, and the nature of God's grace.