For some planets, the orbit is aligned in such a way that the planet passes directly between the star and the observer. In this case the planet partially obstructs the host star making it seem dimmer than it really is. Measurements of the stellar brightness over time then can reveal the presence of a planet. Even more than that, the exact shape of these measurements, the transit lightcurve, allows to infer many important aspects of the planet. Most importantly, from the transit depth the size of the planet can be determined, and together with a mass measurement from radial-velocities, this gives us the planetary density. From the density first inferences can be made on the planet composition, and we learn whether the planet is solid like the Earth, a gas giant like Jupiter or occupies a spot in between these extremes.
More than that, transits can also carry the signatures of the planetary atmospheres. During transit, the stellar light passes through the planetary atmospheres that imprints its spectral signature on it. From a careful analysis of the wavelength-dependent transit depth, molecules such as water can be identified in the planet’s atmosphere.
Half an orbit after the transit the planet passes behind the star, a process called occultation. Here, the light component stemming from the planet is obstructed by the star, and a small drop in the system brightness is measurable. The size of flux drop tells us about the radiation emitted and reflected by the planet, and allow constraints on it’s temperature and composition.