"In the beginning there was nothing, which exploded," at least according to Sir Terry Pratchett, the late and much-lamented English satirist.
What that "nothing" was and why it exploded are left as an exercise for the interested student, but eventually the remnants of the explosion cooled down enough that the universe was full of matter and electro-magnetic radiation and neutrinos and (maybe) dark matter but nothing was very clumped together, although things weren't quite perfectly uniform. In terms of normal matter, there was about 75% hydrogen and 25% helium, with a tiny fraction of lithium and not much else.
All these elements were the result of protons an neutrons sticking together between the time they first condensed out of the quark-gluon plasma, which was around ten seconds after the Big Bang, and twenty minutes or so later, by which time the free neutron number had dropped off significantly. Free neutrons (neutrons not bound to protons by the strong nuclear force) decay with a lifetime of about 15 minutes, so after the first twenty minutes there were fewer neutrons around due to decay, and also the number of free neutrons had been vastly depleted because so many had stuck to protons. It's a curious coincidence in the history of our universe that the timescales for these two processes are so similar.
So the universe at half an hour old was an expanding ball of hot, dense, fully-ionized gas that was almost perfectly uniform. For a long time after that the gas that filled the universe stayed mostly ionized, because it was so hot that collisions between atoms had more than enough energy to knock their electrons loose, if they had any. But around 380,000 years after the Big Bang the universe had cooled off enough that atoms could capture electrons and keep them.
This had a fairly big impact, because it meant light could travel long distances for the first time. Before then, the universe was full of a charged gas (a plasma), which is a highly conducting fluid, and light cannot travel through highly conducting materials. So far from light being there "in the beginning", it only started to become important when the universe was about as old as the human race is today, and "In the beginning, Ford said, 'Let there be automobiles'" would not be a great way to start the history of humanity.
Up until this point there is pretty good general agreement on what happened when, but after this we leave the safe, simple, secure ground of particle physics and run up against the chaotic, complex, and confusing field of fluid dynamics.
Particle physics is hard because the processes involved are unfamiliar, and somewhat quantum. Fluid mechanics deals with processes we all see every day: the motion of clouds, the dispersion of smoke, the way water drains from a sink. But it turns out that unlike the elegant, solveable, linear equations that govern particles and their interactions, the equation that governs fluids--the Navier-Stokes equation--is intractably non-linear. The equation can be written down using extremely basic first-principles, but solving it is hard enough that one of the million-dollar Millennium Prize questions is, "How do we make this easier."
The gas that filled the universe didn't just smoothly flow. It developed turbulence, which has the unfortunate feature that you can't understand the flow at the largest scales without also understanding it at the smallest scales. The great German physicist Werner Heisenberg once said that when he died he had two questions for God: why relativity, and why turbulence? And he was hopeful God would have an answer for relativity.
The picture is made even more challenging by the presence of "dark matter", whatever it may turn out to be. We know that at the largest scales the motions of galaxies can't be described by Newtonian gravity if ordinary matter is all that is out there, but we don't really know if there is some exotic kind of matter that makes up the difference, or if the law of gravity operates differently at very large scales (this seems less likely now based on various observations) or if something completely different is going on.
So understanding the evolution of the next 150 to 200 million years of the evolution of the universe is a very hard problem. At the end of that time we know that stars and galaxies were starting to form, but we aren't even sure which order this happened in. It seems more likely that galaxies formed first, as denser volumes of the universe-filling gas, and then stars formed as turbulent flow in those local densities triggered what's called the Jean's Instability, after British physicist Sir James Jeans: if the gas in a volume is dense enough and cold enough, its pressure will be too low to prevent gravitational collapse.
We call the results of such collapse events "stars".
One of the most important equations in cosmology and astrophysics is something called the "Initial Mass Function" (IMF), which is the probability distribution of stars a the time of formation as a function of mass. The shape of this function, particularly at low masses, is a bone of considerable contention, and it is relatively hard to constrain it based on observations because so-called "brown dwarf" stars, which are small and dim, are incredibly hard to detect.
Fortunately, we are getting better at detecting small, dark, objects all the time. Techniques like "gravitational microlensing", which look at the effect of otherwise-invisible massive objects on the light from far-distant stars, promise to help nail down the population of small star-like objects that aren't quite big enough to shine with sufficient light to be seen at a distance.
This work is not yet done, and the shape of the IMF in the low-mass range is still a matter of considerable dispute. Digging more deeply into it may help distinguish different models of dark matter, and might even help us answer that age-old question: "Which formed first, galaxies or stars?"
Fascinating as usual…but my brain caught at the beginning with the mystery of nothing exploding…