Succession in the New Kingdom was generally in order of eldest sons by official wives (usually referred to as “royal wives”), though these are more guidelines than exact historical rules. For example, the founder of the 19th and 20th dynasties (Ramesside period) was not of royal lineage at all: Ramesses I (1292-1290 BCE) was of noble but non-royal birth, and became a favorite advisor and then appointed heir to the childless Pharaoh Horemheb, who himself had similar origins from a noble military family, eventually finding favor in the court of Tutankhamen, and then being named his successor. The general theory on Horemheb’s choice is that he already trusted Ramesses I a great deal, and he had familiarity with the court and ruling nobles, and that he already had a son (Seti I, ruled 1290-1279 BCE) and a grandson (Ramesses II, ruled 1279-1213 BCE), and thus a clearly defined line of succession for at least two generations.
Ramesses II was succeeded by Merneptah (1213-1203 BCE), who was his 13th eldest son, by Isetnofret, because literally all the others had died. This kind of circumstance is not uncommon in ancient Egypt: if you follow the line of succession you’ll find most were not actually their predecessors’ eldest son proper, but only the eldest surviving son. The New Kingdom period ends in 1107 BCE with Ramesses XI, at which point Lower and Middle/Upper Egypt are separated, with the later having a dynastic monarchy and effectively ruled by the High Priests of Amun. This era is called the Third Intermediate Period and is characterized by political fracturing across the entire region, and naturally the lines of succession become much more irregular.
An invaluable resource on this topic is Ian Shaw’s The Oxford History of Ancient Egypt, which is available online at the Internet Archive as a public domain PDF.
https://archive.org/details/TheOxfordHistoryOfAncient
Edit: added reigning years of Ramesside pharaohs to provide better context, corrected my source from Peter James’ Centuries of Darkness to Ian Shaw’s The Oxford History of Ancient Egypt