I can’t explain this one, but I’d like to offer some other identifiers used. When searching for likely planets, they observe stars for wobble in their position. Large planets like jupiter and Saturn have some hefty pull on our own star. The common orbital point between them, called the barycenter, is still inside the sun, but their great distance apart pulls that barycenter closer to the edge of the sun. Our sun has a pretty notable wobble as a result. That’s the kind of thing they look for elsewhere. If there’s no other star causing the wobble in a binary system, then it must be a planet pulling it.
By estimating the mass of the star by various observations of color, brightness, and brightness variation, they can do some “easy” algebra to calculate the size of the affecting planet. From there, they can scan for radiation frequencies in the darkness where they think a planet is sitting. Water has a frequency, hydrogen has a frequency, oxygen has a frequency, helium, etc. By stuffing objects close to home, we can extrapolate that info and apply it to further objects with some confidence. This is how organic compounds were discovered in Venus’ atmosphere.
A lot of it is based on what we have at home, meaning we’re largely looking for what we have and then identifying it as the same. There is uncertainty about some details, but that’s how it always goes with science. It’s always being updated. It’s takes a lot of creativity to imagine what else might be out there and to devise how to look for it. Black holes are a pretty notable example. Since they’re not observable directly, what do you look for? Well, you look for other things being eaten and hope the matter is hot enough to throw a lot of radiation. 80 years ago, they were just an idea. Now we have images of a few galactic-center black holes. Some have been observed free floating through space by distorting the apparent position of stars behind it. Do we absolutely know it was a black hole? No, but that’s what solid theories can identify it as given the darkness and huge mass required to cause that kind of effect. But, as a result, estimates for dark and cold objects vary greatly because they’re the hardest to observe. There’s talk of finding more “hot jupiters” than expected, but it’s totally valid that maybe wevre just missing the cold Jupiter’s because they’re hard to see.