This is a short summary of how astronomers model ``real'' stars inside a computer, and what they learn from them.
Like any scientific computer model designed to mimic how nature works, astronomers start with the known laws of nature. All information that describes a computer model and the results emerging from it must be consistent with these laws - or else have strong evidence to the contrary. What are the key ingredients?
1. The four fundamental forces of nature
Take the gas that is commonly found in the interstellar clouds from which stars form, place a typical star's mass of that gas inside a volume corresponding to the size of a typical star - nature's laws take over and the computer produces synthetic stars that match the observed properties of real stars to great accuracy. The only adjustable parameters1 are the ones you'd expect - the star's mass and elemental composition. Computer models are now becoming sophisticated enough to start with the initial collapse of a cloud of gas and then self-consistently produce a cluster of full-fledged stars with a range of masses.
Changes that occur in the star's core, due to fusion, result in changes throughout the rest of the star. Computer models can track these changes from the star's core to its surface as a function of time, and so allow the astronomer the ability to predict how a single star (or a cluster of stars) will age over time - changing its radius, surface temperature, luminosity, and other observable properties as it does so. All of these can be compared to nature. In the case of the Sun, we can use the results of helioseismology to measure almost its entire interior structure - even the composition of its core (where fusion occurs) to know how much hydrogen has been converted into helium over its lifetime. The results of these simulations tell astronomers about how stars of differing mass (and intial composition) age, and what elements they spew back out into their environs as they age and die - to be utilized by the next generations of stars.
There are also computer models that synthesize the spectra of stars by modeling a star's photosphere and atmosphere in detail (not so different from the computer models of Earth's atmosphere used by meteorologists - but the physics is simpler). Here the astronomer is interested in the details of how light is emitted by the star. This model, too, is built from scratch from the bottom up, using only the laws of nature, and its results can be compared to the spectra of real stars. The results of these simulations give the astronomer detailed knowledge of the star's emitting structures - elemental abundances present in its gases, the run of temperature and density through its photosphere and atmosphere - as well as a description of how a star's spectrum changes as it ages. It also gives clues to the fusion reactions going on inside, since the convective outer layers of "cool," aged giant stars can reach down deep where fusion is occuring and bring up newly formed elements to the surface.
1The process of convection is turbulent and so chaotic in nature - it is what you see happening in a pan of water heated on a stove, and is responsible for the formation of thunderstorms. Stars with significant convective energy transport are presently modeled with 1 or 2 additional adjustable parameters (crudely speaking: the degree of mixing and the mixing length through the convective zone). However, more accurate treatments of this process are becoming available as computers become faster. While it is crucial that astronomers eventually gain a fuller understanding of convection, the present uncertainties are not "fatal" to the stellar models. Other effects that require more attention are those related to stellar rotation, stellar winds, small amounts of gravitational settling of helium and the heavy elements, in some cases magnetic fields, and finally radiative transfer and turbulence within the star's photosphere and atmosphere. We know a heck of a lot, but there is still more to know about stars.