NASA explains how it knows so much about space and planets. It has a lot to do with being really smart of course with the limited information it has.

They explain how they are able to determine an exoplanet's size, composition and atmospheric make up:
By observing periodic variations in the parent star's brightness and color, astronomers can indirectly determine an exoplanet's distance from its star, its size, and its mass. But to truly understand an exoplanet astronomers must study its atmosphere, and they do so by splitting apart the parent star's light during a planetary transit
Check out the video below: