The way that scientists and astronomers are able to see amazingly distant objects in space and describe them to us is almost unbelievable. Every object in space, be it a planet, a star, a comet, or an asteroid, either reflects or gives off light. That light can be measured and observed most accurately by telescopes and probes sent out into space.
The Hubble Telescope has been able to send back such incredible images, and to find over 400 new planets outside of our solar system because it is above the Earth's atmosphere and pollution, so it gets a clear look into space. That, and the fact that it is a very powerful telescope.
Different elements reflect light differently, so we are able to identify the age of a star based on how much reflected hydrogen and carbon is in the light beams generated from it. Our star, the Sun, for example, is a middle aged star, with about 2.5 billion years of hydrogen fuel left. We can tell that based on the light it gives us to read. We can tell the age of a nebula (remains of an exploded star) based on the distance that its farthest edges are apart and how fast the material is moving.
Recently, scientists have discovered other planets outside our solar system that have observable atmospheres, temperatures which could support life, and water.