The primary reason for the Ming dynasty's collapse was the onset of the Little Ice Age. The colder weather caused crop failures and famine. This was exacerbated by a cutoff in the supply of silver, which was the medium through which taxes were paid. Faced with bad harvests and an increasing tax burden due to deflation of silver, the peasants rose up in rebellion. The capital, Beijing, fell to a rebel army under Li Zicheng in 1644, bringing an end to the Ming dynasty.
The story doesn't end there, however, because then the Manchus came into the picture. Wu Sangui, the Ming commander of the forces stationed at the Great Wall, was about to surrender to Li Zicheng's army when he learned that his concubine had been imprisoned by Li. Wu then decided to ally with the Manchus and opened the gates of Shanhai Pass to let them into pass into China proper. The Manchus promptly captured Beijing and formed the Qing dynasty.
Ming loyalists held out in Southern China and Taiwan until 1683, when the Zheng family in Taiwan surrendered to Qing forces.