The An Shi Rebellion lasted for seven years and two months, and in these seven years or so, the Tang Dynasty changed three emperors, from Tang Xuanzong Li Longji to Tang Suzong Li Heng to Tang Dynasty Emperor Li Yu, while the rebel leaders changed four, from An Lushan to An Qingxu to Shi Siming and finally Shi Chaoyi.
It can be said that the internal strife caused the rebels' combat effectiveness to continue to decline, and finally lost to the Tang, but even if the Shi Dynasty volunteers were defeated and committed suicide, the rebellion did not really end, but only stopped rebelling against the Tang. But it exists in another form. At that time, all the generals who surrendered were allowed by the Tang to take their original positions, which was both a trap dug by the servant Huai'en for the Tang dynasty, and also a last resort of the Tang Dynasty, after all, the destruction of the Anshi Rebellion was too great, the prosperity of the Tang Empire collapsed, the majesty and unity of the empire were all gone, and the feudal towns were divided into powerful regional forces, more and more out of the control of the Tang Dynasty. The economy was devastated and people were displaced.

And the maker of this rebellion was An Lushan, a fat man weighing 330 pounds, he had been loyal and honest like a clown in front of Tang Xuanzong, deeply trusted by Tang Xuanzong, and even became the adopted son of Yang Guifei, under the promotion of Li Linfu, An Lushan quickly became the envoy of Fanyang Jiedu and the envoy of Pinglu Jiedu, and later sought the envoy of Hedong Jiedushi, one person unified the three towns, became the strongest existence after Wang Zhongsi, when Wang Zhongsi once commanded the four towns, although he was Tang Xuanzong's adopted son, he could not get the trust of Tang Xuanzong, and finally he was framed and violent.
After that, An Lushan commanded the most troops. Pinglu, Fanyang, and Hedong added up to 183,900 people, while the total number of presidential soldiers in the ten festivals at that time was 495,000. An Lushan alone commanded more than one-third of the troops, and the total strength of the ten knots accounted for about 85% of the national army, so that An Lushan's own troops accounted for nearly one-third of the Tang Empire. Of course, An Lushan's military command in the Hedong region was relatively small.
However, in 755, when An Lushan raised an army, he still had enough to gather 150,000 troops, including all the troops of Pinglu and Fanyang, plus some of the troops of Hedong, as well as the strength of the Tribes of Tongluo, Xi, Khitan and Murong Wei, and gathered enough troops of 150,000 horses, claiming 200,000, and rebelled with Fanyang as the base, under the name of An Lushan's edict to attack Yang Guozhong on the orders of the imperial court.
Soon, the whole country was in turmoil, and when Chang'an was about to fall, Tang Xuanzong's "Imperial Conquest" ran southward, and the famous Ma Songyi mutiny occurred at Ma Songyi. Then Emperor Xuanzong of Tang entered Shu and became Emperor Taishang, and the crown prince Li Heng ascended the throne as emperor in Lingwu. The war to regain the two capitals began, and An Qingxu killed his father An Lushan and made himself emperor, but there was a disagreement between An Qingxu and Shi Siming, and later after An Qingxu turned to Shi Siming for help in the Battle of Xiangzhou, Shi Siming killed An Qingxu and took over the rebel army in an all-round way, claiming the title of emperor.
In 761, Shi Chaoyi killed his father Shi Siming and declared himself emperor. At this time, the rebels no longer had a unified command as before, and Shi Chaoyi did not bind the rebels. In the battle against the Tang army, it was almost defeated. In October 762, Emperor Wu of the Tang Dynasty ordered his servant Gu Huai'en to lead various envoys to attack Luoyang as a deputy marshal. Shi Chaoyi led 100,000 elite troops to reinforce Luoyang, but was defeated by the servant Gu Huai'en, and Shi Chaoyi suffered heavy losses, being beheaded 60,000 and taken prisoner by 20,000. After that, Shi Chaoyi fled east with hundreds of light horses, while Gugu Huai'en led the Shuofang army to continue to pursue Shi Chaoyi. Several counter-offensives organized by Shi Chaoyi failed.
Shi Chaoyi's subordinates surrendered to Tang one after another, and with no way out, Shi Chaoyi hanged himself in the forest. The Anshi Rebellion ended there.
At that time, the servant Gu Huai'en had already had a conflict with the imperial court, and he had a different heart, so he did not exterminate the rebel envoys who had surrendered to the Tang Dynasty, on the contrary, he asked the imperial court to reinstate them as officials, Tian Chengsi as wei Bo jiedushi, Li Huaixian as Lu Longjiedushi, Li Baochen as Chengde jiedushi, and Xue Song (Xue Rengui's grandson) as Xiangwei jiedushi, and there was no difference between the previous and the imperial court, in order to appease the people's hearts and quickly end the war, so he agreed to the request of the servant Gu Huai'en, and since then the Tang Dynasty has entered the situation of dividing the feudal towns.
The old department of Heshuo still honored An Lushan and Shi Siming as saints, and Tian Chengsi also built a shrine for An and Shi Siren, with the title of "saint". In the ninth century, during the tang muzong period, the influence of An Lushan and Shi Siming was still there.
References: Old Book of Tang, New Book of Tang, Zizhi Tongjian