As early as 1516, Portuguese traders began stopping in Macau on their way to Japan. Portugal asked for -- and was granted -- permission from China to set up an outpost on Macau. China, however, did not relinquish its sovereignty over the port.
To this day, Macau is not a colony of Portugal, but rather a Chinese territory under Portuguese administration, an
arrangement agreeable to both sides.
Some of the good will in Macau today also stems from the fact that Chinese interests always have been stronger in Macau than in Hong Kong.
During the start of China's Cultural Revolution in 1966, pro-China sympathizers in Macau brought the Portuguese government to its knees.
By 1999 Portugal was only a minor nation in the EU, keeping a colony so far away and if it was against the will of a rising China was not in Portugal's interest.
In 1966, there was a riot where local Chinese were killed by securities forces of Macao. The reaction of the Chinese was a overall total diffidence against the Portugal where working with mainland China, they cut off all food and water supply and I beleive after three days the authorities in Macao, abide by Chinese demand and sign a note of "apology". From then on Portugal knew they have no hold on Macao and if China's wants it back, she would have to give.
China waited until after Hong Kong was handed over to received Macao. One thing at a time.
https://www.quora.com/Why-did-Portugal-hand-over-the-Macau-Peninsula-to-China
The return of Macau to the PRC is part of a larger picture of anti-colonization sentiment that goes back to the Paris Peace Treaties at the end of World War Two. In the Paris Peace Treaties, 巴黎和約 there was a general theme of colonies being either liberated or returned to their former (rightful) owners. Finland had to return the territory of the Soviet Union it was occupying. Italy gave up its claim to its colonies, several of which became independent states. After the signing of the Japanese Instrument of Surrender, Taiwan was taken from the Japanese and returned to the Republic of China. At this time, Hong Kong was also promised to be returned to the Chinese.
So, the return of Macau to the Chinese is following the trends set in the post-war era. It should come as no surprise that the Portuguese turned over Macau, which was traditionally Chinese territory, to the People's Republic of China.
Portugal had left all other colonies in 1974-5. In this case China asked them to stay.
下圖紅色為葡萄牙本土 棕色為葡萄牙之殖民地,主要在非洲