It depends on the royal house, but most of them say the firstborn comes first. The lines of succession of the defunct houses of Hohenzollern, Serbia, Legitimist (vs Napoleonic or Orléanist) France follow firstborn Salic succession--meaning first born boy inherits, even though they inherit just a "head of house" title and not an actual throne.
Monaco still follows male preferred inheritance, so even though Jacques is younger than his twin Gabriella he will one day be the Ruling Prince of Monaco.
For Denmark, Vincent is older than his twin Josephine so he inherits first (after his older brother Christian and older sister Isabella). Denmark's succession, like that of the U.K., Sweden, Norway, Belgium, Luxembourg, Netherlands is based solely on birth order regardless of gender.
A lot of non-European monarchies are seniority based--meaning that the eldest descendant of the founder of the dynasty inherits--like it Saudi Arabia--or dynastically elective--like in Malaysia, or Cambodia. Some are ruler designated--meaning the king or prince or shah or ruler chooses the successor.
TLDR it really depends on the individual law of the ruling house.
Edited to change Indonesia to Malaysia.