Here is a review of some simple cosmological equations that are sometimes surprisingly hard to find in leading cosmology textbooks.

Everybody knows the Friedmann equations, so I am not going to re-derive them. Deriving them from Einstein's field equations is easy (indeed, one of the examples I developed for the tensor algebra code in Maxima does just that.) Mukhanov in his book Physical Foundations of Cosmology (Cambridge University Press, 2005) shows how the equations can also be derived (albeit without a spatial curvature term) from Newtonian physics. Anyhow, here are the equations in their full glory:

\begin{align}\left(\frac{\dot{a}}{a}\right)^2+\frac{k}{a^2}&=\frac{8\pi G\rho}{3}+\frac{\Lambda}{3},\\
\frac{\ddot{a}}{a}&=-\frac{4\pi G}{3}\left(\rho+3p\right)+\frac{\Lambda}{3},\end{align}

where $a$ is the scale factor of the universe, $k$ is the curvature, $G$ is the gravitational constant, $\rho$ is the density, $p$ is the pressure, and $\Lambda$ is the cosmological constant. The overdot represents differentiation with respect to time.

The Friedmann equations describe a universe that is spatially homogeneous and isotropic. That is, everything in a Friedmann universe depends on time only, not on spatial location. The scale factor, in particular, which is also a function of time, tells us how distances change as a result of cosmic expansion (or contraction). So if a distance was, say, $d_1$ at some time $t_1$, then at $t_2$ it will be $d_2=d_1a(t_2)/a(t_1)$.

Without loss of generality, we can set the curvature parameter $k$ to $0$ or $\pm 1$. That is because if it has any other value, we can rescale $a$ by a factor of $\sqrt{|k|}$, as apart from the $k/a^2$ term, the absolute magnitude of $a$ does not appear anywhere else in the equations, only ratios like $\dot{a}/a$ which are independent of any constant rescaling of $a$.

The quantity $\dot{a}/a$ is none other than Hubble's "constant". (Or rather, the value of $\dot{a}/a$ at the present epoch is what we call Hubble's constant.) Using $H=\dot{a}/a$, we can rewrite the equations as follows:

\begin{align}H^2+\frac{k}{a^2}&=\frac{8\pi G\rho}{3}+\frac{\Lambda}{3},\\
\dot{H}-\frac{k}{a^2}&=-4\pi G\left(\rho+p\right).\end{align}

Dividing the first equation by $H^2$ and moving the curvature term to the right-hand side leads to the following form:

\begin{align}1=\frac{8\pi G\rho}{3H^2}+\frac{\Lambda}{3H^2}-\frac{k}{(aH)^2},\end{align}

or

\begin{align}1=\Omega_m+\Omega_\Lambda+\Omega_k,\end{align}

where the dimensionless quantities $\Omega_m=8\pi G\rho/3H^2$, $\Omega_\Lambda=\Lambda/3H^2$ and $\Omega_k=-k/(aH)^2$ represent the relative contributions of matter, the cosmological constant (or vacuum energy) and spatial curvature to the total curvature of the universe. Furthermore, sometimes $\Omega_m$ is further split up into contributions representing baryonic matter, dark matter, and radiation: $\Omega_m=\Omega_b+\Omega_{\rm DM}+\Omega_\gamma$.

But we can do more than this. We can associate an effective density and an effective pressure with the cosmological constant: $\rho_\Lambda=\Lambda/8\pi G$ and $p_\Lambda=-\Lambda/8\pi G$. Similarly, we can associate an effective density and pressure with the spatial curvature: $\rho_k=-3k/8\pi Ga^2$ and $p_k=k/8\pi Ga^2$. Using $\rho_m$ and $p_m$ to describe the density and pressure of matter to avoid any ambiguity, we can now rewrite the Friedmann equations as follows:

\begin{align}H^2&=\frac{8\pi G}{3}(\rho_m+\rho_\Lambda+\rho_k),\\
\dot{H}&=-4\pi G\left(\rho_m+\rho_\Lambda+\rho_k+p_m+p_\Lambda+p_k\right).\end{align}

This formalism allows us to treat most forms of matter, the cosmological constant, and spatial curvature on the same footing, represented in terms of an effective density and pressure.

Indeed, for most substances, a mathematical relationship exists between density and pressure. This is called the equation of state. For instance, take the ideal gas law: $p/\rho\propto T$, where $T$ is the temperature. So for an ideal gas at constant temperature, the ratio of $p$ and $\rho$ is constant. Many other substances can be described by such a constant equation of state. The ratio of pressure to density is often denoted by $w$: $w=p/\rho$.

We can also use $w$ to determine the speed of sound. Generally, the speed of sound in a perfect fluid is $v_s^2=\partial p/\partial\rho$. In the specific case when $w$ is not dependent on $\rho$, this means that $v_s=\sqrt{w}$.

Returning to the Friedmann equations, expressed in terms of $w$ they become

\begin{align}H^2&=\frac{8\pi G}{3}\sum\rho_i,\\
\dot{H}&=-4\pi G\sum\left(1+w_i\right)\rho_i.\end{align}

Here is a set of specific values of $w$ that are important to cosmology:

\begin{align}\begin{array}{cl}w>1&{\rm tachyonic~matter}\\
w=1&{\rm stiff~matter~(speed~of~sound}=c)\\
w=1/3&{\rm ultrarelativistic~particles,~photon~gas}\\
0\lt w\ll 1/3&{\rm normal~matter,~ideal~gas}\\
w=0&{\rm pressureless~matter,~dust}\\
w=-1/3&{\rm spatial~curvature}\\
w=-1&{\rm cosmological~constant,~vacuum~energy,~potential~energy}\\
w<-1&{\rm phantom~energy}
\end{array}
\end{align}

For a massless scalar field $\phi$, the equation of state is given by

\begin{align}w=\frac{\dot{\phi}^2-2V(\phi)}{\dot{\phi}^2+2V(\phi)}.\end{align}

If the scalar field has vanishing potential energy, its equation of state will be close to $w=+1$. Conversely, if the potential energy dominates, $w=-1$. (This also demonstrates that a potential energy term has the same equation of state as the cosmological constant. The same goes for the vacuum/zero-point energy of quantum physics.) For a generic scalar field, all values between $-1\le w\le +1$ are permissible, but other values are not possible unless $V(\phi)$ is negative or $\dot{\phi}$ is imaginary.

Indeed, anything outside of the range $-1\le w\le 1$ is truly exotic stuff. In particular, stuff with $w\lt -1$, often referred to as phantom energy, would cause the universe to end in a "big rip": not only would the expansion of the universe accelerate, but over time, this phantom energy would dominate even on the subatomic scale, ripping even quarks apart. On the other end of this spectrum, $w=1$ describes "stiff" matter in which the speed of sound equals the speed of light; whereas $w\gt 1$ describes faster-than-light tachyons.

Now imagine a cosmos that is dominated by one substance, characterized by its effective equation of state $w$. In this case, the Friedmann equations can be solved directly for $\rho$ and $H$ (and, by extension, $a$). Using the right-hand side of the first Friedmann equation in the second, we get

\begin{align}\dot{H}&=-\textstyle\frac{3}{2}(1+w)H^2.\end{align}

When $w\ne -1$, this equation is solved by

\begin{align}H&=\frac{2}{3(1+w)(t-t_0)},\end{align}

or

\begin{align}a&\propto(t-t_0)^{2/3(1+w)},\end{align}

where $t_0$ represents the "beginning of time" when the scale factor of the universe was zero and its expansion rate infinite.

In the specific case when $w=-1$, the solution is given by

\begin{align}a\propto e^{H_0(t-t_0)},\end{align}

where $H_0$ is the value of the Hubble parameter at some time $t_0$. (There is no "beginning of time" in this case; in fact, we are free to choose $t_0$ to represent the present epoch, in which case $H_0$ is the currently observed value of the Hubble expansion rate.)

If the universe was dominated by $w=0$ pressureless matter (e.g., pointlike stars at large distances from each other, or dark matter) for most of its existence, the present age, $t-t_0$, of the universe is directly related to the currently measured value of Hubble's constant. Given $H_0\simeq 70$ km/s/Mpc, the age of the universe is only around 9.3 billion years. That's not enough; there are many ancient stars and stellar systems that are significantly older than this value. This fact alone is a strong indication that the universe must currently be dominated by something with an equation of state $w\ll 0$.

One other thing we can do is directly substituting the solution we got for $\rho$ (expressed in terms of $H^2$) and $a$, to eliminate $t$. After a small amount of trivial algebra, we get

\begin{align}\left(\frac{a}{a_0}\right)^{-3(1+w)}&\propto 6\pi G(1+w)^2\rho,\end{align}

or more simply,

\begin{align}\rho\propto a^{-3(1+w)}.\end{align}

For pressureless matter, $\rho_m\propto 1/a^3$, which makes perfect sense; the density will be inversely proportional to volume. For photons, we get $\rho_\gamma\propto 1/a^4$. This again makes sense; as the universe expands, not only will there be fewer photons, but the wavelength of individual photons will also be stretched as the photons are redshifted. So the overall energy density decreases more rapidly.

For the spatial curvature term, $\rho_k\propto 1/a^2$. This has special significance. We know from observation that in today's universe, $\Omega_k$ is very small (something like $|\Omega_k|\lt 0.004$). Since $\rho_k$ decreases less rapidly than $\rho_m$, in the early universe, $|\Omega_k|$ must have been astonishingly small. Indeed, if we accept the inflationary scenario, we could end up with $|\Omega_k|\lt 10^{-60}$ or something. To have a dimensionless quantity that's so small, yet not zero, seems implausible to most physicists; it seems much more likely that $\Omega_k=0$ at all times. That said, we cannot exclude the possibility that the universe has a small, but non-zero spatial curvature.

Finally, there is one other commonly used parameter, the so-called deceleration parameter $q$, which is defined by

\begin{align}q=-\frac{\ddot{a}a}{\dot{a}^2}=-1-\frac{\dot{H}}{H^2}.\end{align}

For a universe dominated by a single substance characterized by its equation of state $w$, we find that

\begin{align}q=\textstyle\frac{1}{2}(1+3w).\end{align}

The celebrated Type Ia supernova observations, which indicate that the expansion of the universe is accelerating, imply that $q\lt 0$, hence $w\lt -1/3$. This is another strong indication that something like the cosmological constant or vacuum energy is required to explain what we observe.