To understand how the Republic of China came to be, people must understand that the Chinese regime has repeatedly found itself caught in a cycle of revolts and new dynasties. Typically, a single emperor would rule a dynasty. Generations later, their descendants often became corrupt and led to their eventual overthrow by the citizens. The leader of these people, or anyone from the previous dynasty, would rise to the position of emperor. Consequently, these revolts often fragmented China into several regimes, and they would fight each other until one regime controlled all the others. After that, the same cycle would start again when a new united dynasty was formed.
Note About The Concept of a Chinese Nation
The concept of a "nation" with a specific national language is a modern notion. It was only during the rise of nationalism that this idea began to take shape. Prior to that, borders, languages, cultures, and ethnicities did not have clear-cut lines. They were naturally divided and blurred by geographic locations. Modern-day China was often ruled by several warlords, and never truly had a centralized government for many periods. While historians may mention dynasties that "unified China," they usually are referring to the cultural Han-Chinese regions. However, modern China’s territory includes Manchuria, Tibet, and Western China. All of which had distinct cultures that don't conform to the "traditional" Han-Chinese China.
As a result, these regions have ongoing tensions with Beijing due to their own distinct historical and identities. For example, Tibet has resisted Chinese occupation since 1950, as its people do not identify as Han Chinese. Currently, the Uyghurs have distinct ethnic, cultural, and religious differences. This is a major factor for the CCP's genocide, as they've forcibly assimilated Uyghurs into Han Chinese culture through "re-education camps" since 2014.
The Middle Kingdom
Ancient China was very isolationist and viewed themselves as superior to others. They believed that China was literally the center of the world as the word for China in Chinese, "中國 (Zhōng guó)" translates to "the center kingdom." This self-perceived superiority led to disinterest in any western influences, goods, or technology from other countries. As a result, a trade imbalance developed during the Middle Ages and Renaissance, with Europe desiring Chinese goods but not the other way around.
In the 19th century, European powers sought to address this trade imbalance by introducing opium. The Europeans smuggled in opium, addicting Chinese people with the drug. Despite the Qing Dynasty's demands for the Europeans to cease, they continued. In response, they initiated a war known as the Opium Wars (1839-1842). Due to their lack of modern military weaponry from their disinterest to industrialization, China was swiftly defeated by the Europeans.
Desire to Modernize
China then promptly underwent the "Century of humiliation" with losing its territory and prestige to the imperial powers. The old governance system became increasingly inadequate, prompting a national desire for modernization. Numerous revolts ensued, with the most significant being the Taiping Rebellion. The dynasty attempted internal reforms, albeit with limited success. Additionally, China's defeat in the First Sino-Japanese War exposed the Qing Dynasty's corruption and further humiliated the nation. This fueled a growing desire for revolution, driven by the mounting discontent with the Qing state's failures.