The reason for why the Shia do such, can be the following two hadiths:
1- In the famous hadith of Di’bil Khoza’i, the poet of the Ahlul-Bayt, it has been mentioned that when he was reciting his famous poem for Imam Ridha (as) and he reached the part that says Imam Mahdi’s emergence is for sure and that it will be in Allah’s (swt) name and with His bounties, the imam (as) put his hand on his head and arose in respect, praying for the emergence of Imam Zaman (aj).
2- There is also a hadith on the reason for standing when hearing his name. Imam Sadiq (as) was asked about why when the name of the “Gha’em” [The Standing One] is mentioned, all must stand. The imam (as) replied: “The imam’s occultation will be prolonged, and this name is a remembrance of his future rulership and a way of expressing sorrow for his loneliness. As a result, he takes a caring look at the followers of his who remember him with this name out of the love and affection he has for them. It is respectful for the humble servant to stand before his master [the master of his time] when he [the master] is looking at him. Therefore, he must stand and pray for the return of his master.