Mention the word "eunuch", I believe that most friends will think of eunuchs for the first time. In fact, the word "eunuch" first referred to people who studied in the government, and became a synonym for "doorman" in the Eastern Zhou Dynasty.

The earliest "eunuchs" were courtiers who served in the palace, not eunuchs who were castrated. However, because the relatives of these rulers often had to go in and out of the deep palace, it was inevitable that a series of fragrant stories would occur with the concubines, and the later rulers simply "cut one size fits all", so that all the eunuchs lost their fertility and broke their thoughts.
Eunuch rebellion occurred in various dynasties, but eunuchs did not always gain authority. Usually, when the nobility was powerful, it was not the turn of the eunuchs to take power. Only when the central government is highly centralized, that is, when the emperor suppresses the cabinet power and foreign relatives, can eunuchs enter the political arena. Looking at the dynasties where eunuchs were frequently chaotic, such as the Qin, Han, Tang, Song, and Ming dynasties, this was the case.
In the author's opinion, the feudal rule in the Eastern Zhou Dynasty was not yet perfect, the nobles and the monarchs came to power together, and the system of the Wei and Jin Dynasties and the Northern and Southern Dynasties regressed to the landlord society, and the emperor had to look at the faces of the rich and powerful. In this case, eunuchs were naturally not qualified to meddle in politics. In other dynasties ruled by ethnic minorities, such as the Jin, Yuan, and Qing dynasties, the rulers did not engage in the Han Chinese set at all, and even if there were sporadic eunuchs in power during these three periods, it would not be too much of a climate.
As far as centralized dynasties were concerned, eunuchs did not gain authority since the founding of the country. Because around the founding emperor, there is always a group of old comrades who sleep with the emperor, and the founding emperor often trusts these people the most, even if the rabbit and the dead dog cook and kill some of the "thorn heads", they will still give the cabinet power to the remaining founding fathers, and there is no need to support the eunuchs.
For example, at the beginning of the founding of the Tang Dynasty, Gaozu Li Yuan had a group of "Yuanmou heroes" around him, and Li Shimin had a group of comrades-in-arms who carried out coups d'état with him. When Emperor Gaozong of Tang ascended the throne, the old heroes such as Changsun Wuji and Chu Suiliang were mostly old people of Li Shimin, and in order to take power from these old guys, Emperor Gaozong had to rely on his wife Wu Meiniang, thus forming an "inner dynasty" independent of the outer court. After Emperor Gaozong's death, Wu Zetian personally took power and became a female emperor. However, in his later years, Wu Zetian still engaged in another form of "inner dynasty" with male pets, and balanced with the outer court. After Emperor Zhongzong of Tang restored Tang unification, he followed the example of Emperor Gaozong and Empress Wei to build an "inner dynasty". However, in the three "inner dynasties" mentioned above, the emperor relied on his lovers, and there were no eunuchs at all.
The "Inner Dynasty" began to rely on eunuchs to form the "Inner Dynasty", after Li Longji came to power.
How did Li Longji get the throne?
Palace change!
Li Longji learned from several predecessors, and after deposing Empress Wang, he no longer made an empress and forbade the women around him to participate in politics. However, relying only on the foreign court to handle major state affairs, Li Longji was obviously not at ease. Therefore, Li Longji began to cultivate the great eunuch Gao Lishi around him, and supported him into an internal dynasty force that could compete with the outer court.
Therefore, there is also a situation where "every four parties enter the table, they must first present the force, then enter the imperial court, and the small things will be decided" situation. Before Li Longji, the highest-ranking eunuchs in the Tang Palace were only sipin officials, and it was only during the Xuanzong period that the three pins of "internal attendants" were established, raising the great eunuchs of the inner dynasty to a height comparable to that of the prime minister.
Why did Li Longji choose a eunuch as a close confidant?
This is because eunuchs are all crippled people, and such people who do not even have descendants naturally cannot become the emperor of the "family world". Compared with eunuchs, the prime ministers of the outer court were more dangerous, they were in good health, and they could usurp the throne as emperor at any time and change Jiangshan's surname. In addition, almost every favored eunuch was a slave who had a good relationship with the emperor, who was both obedient and obedient, and never lost his temper like the foreign court ministers. After all, there were very few eunuchs in history who had the same personality as Wei Zheng who dared to speak out and poke the emperor's backbone.
In Li Longji's eyes, Colliers is trustworthy, and during the eradication of princess Taiping, Colliers has made great efforts, and it can be said that Colliers is a very reliable comrade-in-arms. Since Emperor Xuanzong of Tang, every eunuch in power, such as Li Fuguo, Dou Wenchang, Huo Xianming, Tutu Chengcui, Qiu Shiliang, Tian Lingzi, and the like, were all close companions of the emperor when he was the crown prince of the Eastern Palace, but there were a few exceptions, such as Cheng Yuanzhen, Ju Wenzhen, Wang Shoucheng, and Liang Shouqian, who were appreciated by the emperor because of their great achievements.
All in all, the eunuchs who could hold power were important and trustworthy in the eyes of the emperor. In ancient society, "nepotism" was a common problem for almost every ruler, and even many Tang Dynasty prime ministers were former ministers of the Eastern Palace, not to mention the eunuchs who accompanied the emperor every day.
Resources:
[Treatise on the History of the Han and Tang Dynasties, Ten Eunuchs in Chinese History]