Account of the Pre-Mortal Existence according to doctrine of The Church of Jesus Christ of Latter-day Saints:
Before this mortal life, the spirits of all mankind lived with God. The first-born of these was Jesus Christ, and the second born was Lucifer. God announced a Plan of Salvation to allow all spirits to progress and learn, which included giving all spirits a mortal body to live in on Earth. A vital part of this plan was agency (a.k.a. free will), which allowed men to choose between good and evil. This in turn required a way for mankind to atone for sins that they would inevitably choose at some point in their lives (to return to live with their Heavenly Father, which was the purpose of the plan). To this end was the spirit of Jesus Christ appointed: to atone for the sins of mankind, and to conquer both physical death and spiritual death, both brought on by the Fall of Adam. Lucifer did not agree with this plan; he wanted to ensure that everyone would return to live with God by not allowing agency, and he also wanted to be the Savior. Lucifer's plan was in direct opposition to God's, and a War in Heaven occurred in which Lucifer led away one third of the spirits who agreed with him. These spirits were cast out of God's prescence and Lucifer became the Devil, and the spirits who followed him became his angels. The other two thirds of the spirits followed God's plan and received (or in the case of the yet unborn, will yet receive) a mortal body.
[someone please add versions from additional religions...]