The Shulhan Aruch (Orah Haim 224:8), based on the Gemara (Berachot 58a) rules that if one sees a Jewish king, one should recite “Baruch Ata…Shehalak Mikvodo Lire’av” (lit. “Blessed art Thou….Who has apportioned of His glory to those who fear Him”) and for a non-Jewish king, one should recite “Baruch Ata…Shenatan Mikvodo Lebasar Vadam” (lit. “Blessed art Thou…Who gave of his glory to flesh and blood). The Shulhan Aruch (ibid:9) goes on to say that it is a Mitzvah to make an effort to see a king, even a non-Jewish one because it is inspiring and implants in one’s heart the concept of Hashem’s kingship and glory
Rabbi David Cohen-Scali (Kiryat Hana David), a rabbi in Oran, Algeria, discusses the Halachic implications of the president of France’s visit to his city in 1930. The first issue was that the president was travelling in a horse carriage and was not physically seen by onlookers, as such there is doubt as to whether one could recite the blessing. Regarding this, the HIDA (BIrke Yosef, § 224) writes that if one only sees a king’s entourage but knows that the king is present in the entourage, one may recite the blessing. The second issue is whether a president has the status of a king, who is defined as a leader who has the authority to decree capital punishment. Presidents, prime ministers and the like, on the other hand, are usually accountable to a legislative body and cannot simply decree the death penalty. Rabbi David Cohen-Scali cites the Magen Avraham and the Radbaz, who discuss army generals that do not have authority and the conclusion is that a blessing is not recited.
Nevertheless, there are opinions that if a leader has the authority to grantclemency for someone who was sentenced to capital punishment, such as the president of the United States, the blessing may be recited. Furthermore, Rabbi Ovadia Yosef (Hazon Ovadia, Hilchot Berachot, pg. 413) says that if a president or prime minister has the authority to declare war without going through a legislative body, one may recite the blessing. Regarding modern-day kings and queens like Mohammed VI or Elizabeth II, respectively, who evoke a sense reverence and royalty when they are seen, one should recite the blessing. While some posit that a blessing would not be recited if the king or queen is not dressed in their royal garb, Rabbi Meir Mazuz (Elyashiv HaKohen, vol. II) and Rabbi David Yosef (Halacha Berura, vol. XI, pg, 306) point out that by not wearing their garb they are trying to go incognito or blend into a crowd. However, if they normally dress in civilian clothing and certainly if they are surrounded by their royal entourage, the blessing should be recited.
Summary:One should make an effort to see kings and queens. Onemay recite the aforementioned blessing when one sees a bona fide kingor queen, or on a national leader who has the authority to grant clemencyin a capital case.