I was reading the Wikipedia page for Han Dynasty, and Han Dynasty is divided into Western Han and Eastern Han period. In between Western Han and Eastern Han, Wang Mang usurped the throne and changed the Han Dynasty to Xin Dynasty for 14 years. A distant relative of the last Western Han Emperor, Liu Xiu, managed to raise an army, win several battles and restore the Han Dynasty.
I think the same thing happened at the end of Eastern Han. A distant relative of the last Eastern Han Emperor, Liu Bei, managed to carve out a territory and named his state, Han Dynasty. While the other two states called it Shu Han. This Shu Han also has the same geographic territory of the Kingdom of Han, which is the state of the founder of Western Han.
Why is Eastern Han considered to be a successor of Western Han, but Shu Han is not considered to be the legitimate successor of Eastern Han?
My knowledge is more the three kingdoms than the Latter Han but I hope this will help. Have a great New Year and 2021
Edit: Just to clarify, Liu Bei and co called themselves Han, their rivals called them Shu, historians use Shu-Han though Shu is also used in casual discussions.
The Latter/Eastern Han, it won. Liu Xiu beat out all his rivals, including the Gengshi Emperor, the land was under him and the line from 25 till 220 (though the unity ended in 190). The people of the latter Han considered it restoration and continuation of the Han rule, there isn't a rival candidate any could point to as the real successor to the earlier Han.
A different strand of family, different capital facing its own situations and problems but it claimed restoration of the Han, it was viewed as the restoration of the Han by those who lived in it. Terms of Earlier and Latter help differentiate and which line someone is talking about but still the Han.
Liu Bei did indeed have Han lineage and as the last Liu standing when Emperor Xian abdicated to Cao Pi, he claimed the Han throne. His being in Shu and Hanzhong was useful before that as he claimed the title King of Hanzhong to draw that very comparison you made with the founder of the Han. He, however, did not win and who was the legitimate successor of the three split historians. The powerful northern kingdom of Wei who the last Latter Han Emperor abdicated to or the kingdom to the west with Han lineage that was upholding a grand dynasty?
There were, till Jin won, three competing claims to replace the Han and having the mandate to those so using omens, prophecies, personal qualities, "support of the people" and whatever else they could bring in. Shu-Han via Han lineage and the prestige of the Han (also claiming Emperor Xian was dead which he wasn't) against the cruel and traitorous Cao's.
Wei had Emperor Xian abdicating to Cao Pi and passing on the mandate to the faction that united most of the land and controlled the traditional heartlands, that their prestige and merits on many things made them worthy to take over from the Han dynasty for whom favour had been clearly lost. Shu were rebels, led by disloyal ambitious men who were causing much suffering with their actions.
Wu later made their pitch, they claimed the Han had exhausted the mandate (Shu-Han was not pleased to hear that one) but Wei was unworthy of receiving it due to the cruel nature of the Cao's whereas Sun's had the support of the people and the goodly nature required. This one never gained traction in the centuries ahead
For Jin, the abdication processes from Xian to Cao Pi need to be legitimate for their abdication process from Cao Huan to Sima Yan to be also legitimate, they needed for Wei to be legitimate so they could pass on mandate but also flawed enough to justify the Sima's taking over. Shu-Han being the legitimate successors of the Han would not have been particularly helpful to their own mandate (not till Eastern Jin where the Shu comparisons would be more helpful) and Chen Shou, a proud Yi man and former Shu officer, was not blind to that requirement when writing the SGZ so using terms like First and Second Lord for Shu-Han and Emperor titles for Wei.
Jin however soon fell into civil war and struggled against invasions from abroad and the mandate discussion restarted with the Sima's method of rising (coup, abdication, regicide) becoming more of an issue. For some, Wei remained the legitimate successors, Xian had abdicated and passed on the mandate, they had conquered most of the land among other deeds, they had built a strong state, some rulers could seek to compare themselves to the success of Cao Cao and so built temples to him.
Others argued that the personal moral failings of the Cao's had denied them the mandate, that it meant they could get close but the reason they didn't ever win was due to heaven not supporting them. That the Cao's hadn't united the land so had no right to take over from the Han so the mandate remained with the Han. Since Emperor Xian abdicated, that mandate went to the kindly Liu rulers in Shu and only when Jin conquered them, did it pass from Han to Jin. Eastern Jin scholars argued which calendar was legitimate, Wei or Shu's for Jin to follow.
As things went wrong for China, Liu Bei's journey from sandal weaver to Emperor, his bonds with the already worshipped figures Zhuge Liang and Guan Yu (also Zhang Fei who was not worshipped as far as I can tell), his resistance against the powerful, the Han line also gave him popularity among the masses. Some dynasties, if linking to the Han themselves, if resisting a great northern power, could tap into that.
However, we can not say there was a unified claim that Shu-Han was the perceived legitimate successor of the Han. Modern historians will comment on how those arguments between the two claims for legitimacy were forged, about reputations were changed and shaped, the quality of the claims but without Shu being seen as clear undisputed legitimate successor as the time, in the immediate aftermath or since
Sources:
Bill Cromwell's translation of Liu Bei's SGZ and his annotations
Cao Pi and Cao Rui's SGZ translated by Yang Zhengyuan
Rafe De Crespigny Imperial Warlord