Rahu and Ketu are two astro-mythological terms of Vedic vintage which underwent change and expansion of meaning in 6th century CE.
Contrary to many statements in print and on the internet, the Rgveda does not mention Rahu. In the Rgveda, eclipses of the Sun and the Moon take place when they are swallowed by an asura named Svarbhanu.
The Atharvaveda onwards, the eclipse-causing demon is called Rahu. In the Buddhist Pali literature, the Sun and the Moon successfully appeal to Buddha to rescue them from Rahu.
In the vast Mahabharata text, believed to have been by-and-large frozen in 4th century CE, Rahu is the eclipse-causing demon.
Unlike Rahu which was a proper noun exclusively associated with eclipses, ketu in this period was a common noun denoting a number of related phenomena rather than a particular event. Ketu, in plural stood for comets, meteors and the like. It has even been suggested that at places ketu denotes sunspots.
Astro-mythology changes after Aryabhata (born 476 CE) whose influential text Aryabhatiyam propounds the mathematical theory of eclipses. Note that this is a first for India not the whole world.
According to this theory, eclipses take place when the Moon is at one of the nodes of its orbit. The movement of these nodes can be calculated mathematically so that it now became possible to predict eclipses.
The movable part of the cosmos, what is now recognized as the solar system comprised two class of objects: planets (graha) and calamities (utpata)Since the planets could be mathematically described, they represented cosmic order and were source of comfort.
In contrast, objects like comets appeared from nowhere without warning and thus cause of concern.
Aryabhata’s work transferred eclipses from the category of utpata to that of the grahas.Since eclipses could be mathematically predicted, the two lunar nodes were designated grahas. Since they were not real, they were called shadow planets.
Varahamihira names these shadow planets. The ascending node was called Rahu and the descending node Ketu. Note that since the two nodes are 180 degrees apart, naming one would have been sufficient. But both were included so that the number of planets could be fixed at nine, considered to be a powerful and mysterious number.
While, for Rahu it was a re-definition of his old role, for Ketu it was a new assignment. It continued to be used in the old sense of comets, meteors, etc.
To sum up, when we seek to interpret the terms Rahu and Ketu in the old literature, we must first check what the time period is. Before 6th century, Rahu and Ketu are NOT planets. Rahu is a demon and Ketu a comet or a meteor. Beginning with 6th century CE, Rahu and Ketu become planets. In addition Ketu, continues to denote a comet or a meteor