Confusion of “首相” and "总理" “首相” looks like the prime minister of a royal country, while “总理” is the premier of a republic, but in China's history, there is no official post of ”首相“,but of "丞相“or "宰相", and in the case of countries like Thailand and Malaysia, both of which are kingdoms with king or sultan as the head of state, but the heads of government are named in Chinese (mainland China) as "总理",but not as "首相" like in the UK, Japan, Denmark, Sweden, Saudi Arabia, Kuwait, etc.

By the way, if you have seen pictures of prime minister of Japan, the official name in Kanji of Japanese is "内阁总理大臣", so it should be "总理" but not "首相".

It is very confusing.
In the constitutional monarchy, 首相 is the the head of the cabinet, with the highest executive power. 

首, in ancient Chinese, means the first or top. 相, short for 丞相, are the officials(usually with great power, just below the emperor) of the emperor. Therefore, 首相 is the top official of a central government.

In the republican state, there is no prime minister, and 总理 run the central government.

Countries have 首相: Japan, UK, Netherlands, Denmark, Belgium...

Countries have 总理: China, Germany, India...
Most countries have a 总理, while USA has neither a 总理 nor a 首相, it has a 国务卿(Secretary of State). 
States with 总理 usually have a 总统(president) or a 主席(chairman).