The formation of galaxies is still one of the most active research areas in astrophysics; and, to some extent, this is also true for galaxy evolution.
Some ideas, however, are now widely accepted.
After the Big Bang, the universe had a period when it was remarkably homogeneous, as can be observed in the Cosmic Microwave Background, the fluctuations of which are less than one part in one hundred thousand.
The most accepted view today is that all the structure we observe today was formed as a consequence of the growth of primordial fluctuations.
The primordial fluctuations caused gas to be attracted to areas of denser material, and star clusters and stars.
One consequence of this model is that the location of galaxies indicates areas of higher density of the early universe.
Hence the distribution of galaxies is closely related to the physics of the early universe.