This is a rather complex question, for several reasons.
First, galaxies come in many variations, regarding such diverse
properties as mass, morphology, and environment.
Second, different observational techniques, and different models,
yield different observables — you can observe the same field of the
sky with two different instruments and deduce a ...
The key to understanding this is that dark matter and, effectively, stars are collisionless, whereas gas is collisional.
As written in the second quote, structure forms in a hierarchical, bottom-up fashion. That is, small halos of gas and dark matter (DM) collapse first on small scales, and these halos then merge to form larger halos. ...