Habitable solar systems

The galaxy
Most galaxies fall into three kinds: irregular galaxies are small and formless masses of stars, rich in dust and hydrogen and containing mostly younger stars (see below for star classes); conversely, elliptical galaxies don't have much hydrogen or dust, and their stars tend to be very old; finally, spiral galaxies (such as our Milky Way and our closest neighbour, the Andromeda Galaxy) have a complex structure similar to a pinwheel, with a mixture of both young and old stars. About half of the galaxies (but none of the spirals) are dwarf galaxies. (Notes: Ms is the mass of the Sun, about 2.0 × 1030 kg; Ls is the luminosity of Sun, about 3.8 × 1026 J)

Most likely, life needs heavy elements, a liquid medium and probably a solid ground (also see here and here): only hydrogen and helium, produced by the Big Bang won't be enough. Element heavier than helium, from lithium to iron, are produced by nuclear reaction in the stars, while the rest of the natural elements (until uranium) derive from supernovae.

Dwarf galaxies are very poor in heavy elements, and they can be ruled out, and so, partially, irregular galaxies. Most of the stars in elliptical galaxies, being very old, were born right after the Big Bang, and didn't benefit from an interstellar medium already rich in heavy elements as the younger star did; it seems, therefore, that spiral galaxies are the best chance for complex chemistry.

Once we have chosen a galaxy, we need to find the "habitable zone" in which to search a life-bearing solar system. A large number of red and yellow stars, mixed with dust and gases, form the Disk, comprehending in turn a number of arms highlighted by hotter blue and white stars. The Halo, a spherical region around the main disk, contains only old, cold red stars very poor in heavy elements useful to build a rocky planet (carbon, silicon, iron).

These are much more abundant nearer to the Core, a region extremely rich in young, hot stars. On the other hand, the core is also richer in ionizing radiations, which disrupt atomic bonds and prevents the synthesis of complex molecules; while they'd not be much stronger than the radiation that a planet receives from its own star, the core also presents a higher rate of supernovae within a distance of few light-years.

Life could appear in the outer rim of the Core, though not in its centre: planets there would constantly be enlightened, day and night, by the huge number of stars. Still, the most likely location is the Disk, both inside and outside thae arms. In the Milky Way, the best distance from the centre is thought to be 25000-31000 light years (8-10 kiloparsecs), where most stars are between 4 and 8 billion years old.

Here there is a high-detail map of the Milky Way, produced by National Geographic.

Stars
All stars can be classified into spectral classes on the basis of their temperature, which directly affects their colour. From the hottest and brightest to the coldest and dimmest, the most important classes are called O, B, A, F, G, K and M. They're in turn divided in subclasses, identified by numbers - a star with a number between 0 and 4 is called an "early" member of its class, while a star with a number between 5 and 9 is called a "late" member (for example, as a G2 star, the Sun is an early class-G).

A second number, in roman numerals, identifies the star's luminosity class: 0 for hypergiants, I for supergiants, II for bright giants, III for normal giants, IV for subgiants, V for main-sequence stars such as the Sun, VI for subdwarfs and VII for dwarf stars.

Most of the other characteristics can be inferred from the spectral class, as shown by the tables below: (Note: Ga = gigayear = a billion years; mass in Ms, radius in Rs, luminosity in Ls)

In about 91% of all stars, size is a function of temperature: the line they call on a diagram is called main sequence. In this line, hotter stars are also extremely large (blue giants), while colder stars are small and dime (red dwarves). Stars are born as contracting spheres of gas; after the brief T Tauri-stage, in which a good part of the matter is thrown off, and the luminosity varies quickly. Growing older, stars pass through the main sequence, burning hydrogen into helium, and, depending from the mass, they can undergo different changes: Given the violence of these events, the lack of energy of white and black dwarves and the instability of supergiants and T Tauri stars, it's safe to assume that only stars in the main sequence (and, perhaps, smaller giants) can be suitable for life as we know it. Also, we can exclude O, B and probably A and early F stars as abodes of life: while extremely rich in energy, they burn out in a few millions years, far too little for complex chemistry, life and especially intelligence to occur in their system. M-class stars are a dubious candidate: they last long, but a planet needs to be very close to them to receive a substantial amount of energy (see here a more extensive treatise).
 * When hydrogen is running low, the pressure from the radiation at the centre decreases, and the star begins to separate into two layers: a wide diffuse shell and a hot core where helium is burned into carbon, and carbon into oxygen. The star swells up, becoming a red giant.
 * A star with low mass, such as our Sun, slowly dissipates the shell of hydrogen until only the core remains, becoming a white dwarf. This slowly fades to a cold black dwarf - not a star anymore.
 * A star with higher mass (above 8 Ms at the beginning) continues to burn its elements in different layers, burning carbon and oxygen into neon and magnesium, these in silicon and sulfur, and these in iron. At this point, it becomes a supernova, which explodes, producing all heaviest elements and dispersing them in space. The nucleus can become an extremely dense neutron star, a black hole or an even more violent gamma-ray burst.