Final answer:
The Tang dynasty replaced the Sui dynasty in 618 CE and ruled until its collapse in 907 CE, followed by a period of disunity until the Song dynasty took power.
Step-by-step explanation:
The Tang dynasty came into power in 618 CE, effectively replacing the Sui dynasty, which had reunited China prior to its downfall. The Sui dynasty's collapse was precipitated by a series of military failures and internal strife, particularly its inability to conquer Korea, as exemplified by the devastating loss in 612 where a massive army was decimated.
The Tang dynasty would go on to rule until its own decline, marked by internal rebellions like the An Lushan rebellion, as well as external pressures from various regions and empires, including the Battle of Talas against the Abbasid Caliphate in 751 CE. Eventually, the Tang dynasty collapsed in 907 CE, which led to a period of fragmentation until the Song dynasty's rise to power in 960 CE.