Structure formation: Galaxies as different entities and stars as groups Why do stars exist in groups like galaxies rather than individual stars, and why do galaxies exist as different entities without continuity and with large intergalactic spaces?
 A: Stars exist in galaxies because a certain concentration of cool gas is required in order for the star formation process to proceed. Baryonic gas is drawn into potential wells that are created by pre-existing dark matter structures and it is these that determine the hierarchical structure that is seen in galaxies.
The baryonic gas inflows are able to cool and condense sufficiently for the gas to collapse gravitationally, fragment and begin the process of star formation. Once star formation is sufficiently developed then we see this concentration of gas and stars (and dark matter) as a "galaxy". Further "concentration" is achieved through galactic mergers, where bigger galaxies are built up by the merger of smaller galaxies.
Stars could not be uniformly distributed through space because if the gas they form out of was uniformly distributed then it would be too sparse to be unstable to gravitational collapse.
A: First let's put things into perspective: Stars are nowhere as close to each other as they seem. The nearest star to Earth aside from the sun, Alpha Centauri, is 4 light years away, or 250 thousand times the distance between the Earth and the Sun! 
The cosmological principle assumes a homogeneous Universe. Structure formation in the Universe breaks down the homogeneity of the Universe when perturbed (due to e.g. a sound wave that changes the pressure enough to start gravitational collapse) to smaller entities that collapse onto each other forming structure. (For more on how this happens, see e.g. here or here starting pg. 9 which is a simple treatment of gravitational instability, but not enough on its own to cause the structure we see in the Universe right now, and better but more complicated mechanisms exist.)
The largest structures in the Universe are galaxy superclusters (and inversely, voids). Superclusters usually span half a billion light years and are groups of clusters of galaxies, which are in turn, groups of galaxies, which are formed within the larger structure of superclusters. Galaxy clusters are gravitationally-bound and in fact are the largest gravitationally-bound structure in the Universe. Galaxies then become star-forming regions and similar gravitational instability in interstellar clouds causes stars to form.
So depending on the scales you are looking through, in the small scales you could say that stars are very lonely entities, and on large scales you could say that galaxies do in fact come in groups.
A: Because of gravity:  every spread of matter tend to collapse to it's center of gravity, if there are not counterbalancy force (like pressure, inside a star, or inertia, when rotation is involved, comprising the one created by the beginning of the collapse).
In a perfectly symmetric universe, there would be no prefered direction to collapse, but it is a very instable equilibrium. In practice there are variations at all scales, which make it possible to collapse.
More generally about which win between expend or collapse, see
https://en.wikipedia.org/wiki/Jeans_instability
A: Stars can be found grouped in galaxies because they were born there: galaxies first formed has a gravitational accretion of gas (hydrogen, helium) a couple hundred millions year after the Big Bang. The exact process of galaxy formation is still very not well known. 
But many stars (maybe as much as half of all stars) are also found in intergalactic space, liberated from the attraction of their native galaxy, having been ejected via gravitational interactions (such as the ones used to get gravity assisted acceleration for robotic probes exploring the solar system) or during the collision of galaxies. As a side note, there are similarly many planets that are not bound anymore to the star system were they were born in and travel into interstellar space. 
As for galaxies, they are distributed very differently in large structures as described by Husni Almoubayyed in his answer. 
