the mainland China, Hong Kong and Macau are the territories of the People's Republic of China, which is normally considered as the formal government that represents China. They announce that Taiwan is also a territory of the PRC, but Taiwan and several islands around it are actually ruled by the ex-Chinese government, the so called Republic of China, which is not considered as a legal political body by most countries around the world, including the UN. But it was considered as the formal government of China until 1971, the year when the communist government took over the place of the government of the Republic of China in the UN
the division was caused by the China's civil war from 1945 to 1949, the communist army rebelled and after 4 years of warfare, the communists finally cracked down the governmental army, in 1949, with the assistance of the United States, the Chinese government retreated to the Taiwan Island, and the People's Republic of China was founded that year.