The reason behind Young's rise to prominence is found in an understanding of the organization known as the Quorum of the Twelve Apostles and Young's role in it.
Young joined the church in 1832, 2 years after the church was organized and after the publication of the Book of Mormon, therefore he had no part in the initial roots of Mormonism. In 1834, Joseph Smith organized Zion's camp in Ohio as a military expedition to Missouri in order to fight persecution that the Mormons received there. The camp never actually engaged in any fighting, however there were many who defected and it allowed Smith to gauge who would be loyal to him even in hardship. Brigham Young was a member of this camp.
In 1835 after the return of the expedition, Smith then organized the Quorum of the Twelve Apostles. Most of the members of the the quorum were selected from those who were loyal in Zion's camp. Brigham Young was one of the first ordained and set apart to the quorum but did not have the designation of senior most apostle. As you mentioned many people were excommunicated from the church in those days. Though most of the quorum remained faithful, a few were excommunicated or killed, necessitating calling more people to the quorum. Young quickly became the senior most apostle of the quorum of the twelve. Thomas B. Marsh, who happened to be in the first presidency, was the senior most apostle before his excommunication in 1839. Young was subsequently set apart as president of the quorum in 1840 as a result of his new status as senior most apostle. He held this designation until Smith's death.
Brigham Young was not considered the second-in-charge to Smith. That was given to Smith's brother Hyrum who was ordained "Assistant to the President of the Church". Following him, the other natural successors would seemingly be the members of the first presidency. Hyrum was killed along with Joseph, ruling out Hyrum's succession. The subsequent succession crisis ensued; would it be the senior most member of the first presidency, would it be the senior most member of the quorum of the twelve apostles, or was it to be Smith's posterity?
Several candidates for Smith's succession emerged, and all of them gained some followers. Young contended, using revelations recorded by Smith, that the Quorum of the Twelve Apostles as a body held all the 'keys' of the priesthood that Smith held, and that the first presidency was dissolved upon Smith's death, and that the Quorum held authority equal to that of the first presidency. He was successful in convincing many of his rightful succession. Sidney Rigdon, Young's primary challenger, proposed that Smith have no successor and that he be named "guardian" of the church. The majority of church members rejected that motion. A few others believed that Smith's successor was to be Joseph Smith III (who was not even an adolescent at the time).
Young's personality was forceful, charismatic, and direct. His ability for quick decision making and well-articulated instruction allowed him to emerge as a natural leader following Smith's death. He organized the very difficult colonization of the Rocky Mountains: Utah, Idaho, Nevada, Arizona, and others; he led the church through federal persecution for polygamous practices; he helped organize the difficult immigration of European Mormon converts to Utah. Under his leadership, vast irrigation projects, roads, bridges and even universities were established in Utah and surrounding areas. There is little doubt that he had the credentials to lead the church at that time. Young led the church for a time merely as president of the Quorum of the Twelve Apostles. Most of the extant Quorum of the Twelve Apostles followed him and, with the belief that as a body they had the same authority as Joseph Smith, they eventually ordained Young as Smith's successor in 1847, giving him the same power, authority, and title that Joseph Smith had in the church.
Today, the Church of Jesus Christ of Latter-day Saints, which is the largest LDS denomination and is headquartered in Utah, still follows the same succession practice. When the president of the church dies, the first presidency is dissolved and the senior most apostle is ordained to the office of "Prophet, Seer, and Revelator." It is believed that the current president has the same power and authority that Joseph Smith had.
For more information from official sources, see:
Additionally, the Wikipedia articles covering these subjects, though somewhat disorganized, appear to be relatively accurate and present several other views.