Let's take an example of the sun. The sun is quite simply a giant reactor. A combination of chemistry and physics gives us the answers we need for the sun and most stars. We do not yet understand pulsars, neutron stars and a few others. By knowing the mass of the sun we know both its history and its future. That's how we can observe what's happening inside the stars.