How is the curvature term of the Friedmann Equation calculated with the Newtonian derivation? I'm trying to develop and intuitive understanding of the Friedmann equation.  I'm afraid I get lost with the relativistic derivation as it's just a lot of crank-turning.  When I derive it from the Newton iron-sphere concept, I can see that the constant of integration has the physical interpretation of 'total energy at the surface of the sphere'.  So far, so good.
I don't understand how the total energy at the surface of the 3-Sphere leads to curvature.  I came across this video (which I think is excellent) Astrophysics (Cosmology) 2.4.  At the 9:58, they almost connect the dots.  They make the jump from:
$$U=\frac{1}{2}m\dot{a}^2x^2-\frac{4\pi}{3}G\rho a^2x^2m$$
to multiply both sides by $\frac{2}{ma^2x^2}$, and then to this equation:
$$\left(\frac{\dot{a}}{a}\right)^2=\frac{8\pi G}{3}\rho-\frac{kc^2}{a^2}$$
$$k=\frac{-2U}{c^2x^2}\tag1$$
But they don't explain how the curvature got into the equation.  Can anyone tell me from where Eq. (1) comes?  I don't recognize it and it's the last piece I need to understand curvature.
 A: A genuine derivation of the Friedmann equation would go through general relativity. You would start with the spacetime metric, which determines the curvature $k$, and then evaluate the Einstein field equations to get the result.
When gravitational effects are weak, general relativity reduces to Newtonian mechanics. Therefore, in some limits, it should be possible to describe the same observable behavior entirely within Newtonian mechanics. In other words, there should be relativistic equations and Newtonian equations that lead to the same $a(t)$.
However, these equations aren't going to look exactly the same. The relativistic equation will have a term involving the curvature $k$ (which can't be defined in Newtonian mechanics), while the Newtonian equation will have an analogous term involving the total energy $U$ (which is tricky to define in general relativity).
The best you can do is say, "for this value of $k$ in the relativistic derivation, plugging in this equivalent value of $U$ in the Newtonian derivation would give the same solutions for $a(t)$". It turns out the equivalence is $k = - 2 U / c^2 x^2$, but this can't be derived in Newtonian mechanics, because there's no such thing as curvature in Newtonian mechanics; everything is perfectly flat.
A: I've seen this "derivation" before. You first start with the EOM (Newton's second law) for a particle at the boundary of the sphere
$$m\ddot{r}=-\frac{GMm}{r^2}.$$
If we eliminate $m$, substitute $\ddot{r}=\ddot{a}x$ and $M=\displaystyle\frac{4}{3}\pi r^3\rho$ we get to
$$\ddot{a}x=-\frac{4\pi G}{3}\rho\ r$$
and dividing by $x$ to
$$\ddot{a}=-\frac{4\pi G}{3}\rho\ a.$$
We can integrate this equation by noticing that $\displaystyle\ddot{a}=\frac{d\dot{a}}{dt}=\frac{d\dot{a}}{da}\frac{da}{dt}=\frac{d\dot{a}}{da}\dot{a}$, therefore
$$\int\dot{a}d\dot{a}=-\int\frac{4\pi G}{3}\rho\ ada\tag{1}$$
Now, integrating $(1)$ will give you a constant on one side of the equation, let's name it $C$:
$$\frac{\dot{a}^2}{2}=-\frac{4\pi G}{3}\int\rho_0\frac{1}{a^2}da$$
$$\frac{\dot{a}^2}{2}=\frac{4\pi G}{3}\rho_0\frac{1}{a}+C$$
$$\frac{\dot{a}^2}{2}=\frac{4\pi G}{3}\rho\ a^2+C.$$
The constant $C$ must have the same dimensions as the other two terms in the last equation, i.e. it must have dimensions of $[T]^{-2}$. Hence, nothing prevents me from writing the constant $C$ as
$$C\equiv \frac{kc^2}{2},$$
where $c$ is the speed of light (with dimensions $[L]/[T]$)and $k$ is a curvature, i.e. it's something that has dimensions of curvature $([L]^{-2})$. By making this renaming of the constant of integration, you arrive to the Friedmann equation in the way it is usually stated (as derived from General Relativity).
$$\left(\frac{\dot{a}}{a}\right)^2=\frac{8\pi G}{3}\rho-\frac{kc^2}{a^2}\tag{2}$$
From here, to show the relation between $k$ and $U$ that you state just multiply both sides by $a^2x^2/2$, you get
$$\frac{1}{2}\dot{a}^2x^2=\frac{4\pi G}{3}\rho a^2x^2-\frac{1}{2}kc^2x^2.$$
Now since $v=x\dot{a}$ and $\rho=\displaystyle\frac{M}{\displaystyle\frac{4}{3}\pi r^3}$
$$\frac{1}{2}v^2=\frac{4\pi G}{3}\displaystyle\frac{M}{\displaystyle\frac{4}{3}\pi r^3} r^2-\frac{1}{2}kc^2x^2$$
$$\frac{1}{2}v^2=\frac{GM}{r}-\frac{1}{2}kc^2x^2$$
$$\frac{1}{2}v^2-\frac{GM}{r}=-\frac{1}{2}kc^2x^2.$$
Finally, identify the LHS with the total energy per unit mass $U/m$ and solve for $k$.
One last bit, the interpretation of $k$ is done in the same way as in general relativity. First, we know experimentally that $\dot{a}>0$ at the present time, i.e., the Universe is expanding right now. By looking at equation $(2)$, we see that if $k<0$ the RHS of Eq. $(2)$ will be positive at all times, indicating that $\dot{a}(t)>0$ for all $t$ and the Universe will expand forever. To see this more clearly, rewrite the Friedmann equation as
$$\dot{a}^2=\frac{8\pi G}{3}\frac{\rho_0}{a}-kc^2.\tag{3}$$
Notice how for $a\rightarrow\infty$, $\dot{a}^2$ approaches a constant value $-kc^2$. If $k=0$, then the RHS of Eq. $(2)$ will also be positive forever, but in such a way that the expansion eventually stops at very large $a$, cf. Eq. $(3)$, $$\dot{a}\rightarrow 0\, \text{ as } a\rightarrow\infty\quad (k=0).$$
Finally, if $k>0$, the RHS of Eq. $(2)$ will vanish at a value of $a_{max}=\displaystyle\frac{8\pi G\rho_0}{3kc^2}$. At that point the expansion will stop and the Universe will start contracting $(\dot{a}<0)$. The sign of $k$ then, separates Universes that expand forever from Universes that recollapse in the future.
A: 
Can anyone tell me from where Eq. (1) comes?

The curvature come from the right-hand side ($U$) of your first equation (modified a bit, merged $a$ and $x$ into a single $a$, since $x$ in your equation is apparently a fixed constant which can be absorbed into $a$ or set to $x=1$ in the chosen unit):
$$
U=\frac{1}{2}m\dot{a}^2-\frac{4\pi}{3}G\rho a^2m
$$
In the Newtonian derivation, you can regard
$\frac{1}{2}m\dot{a}^2$ as kinetic energy, $\frac{4\pi}{3}G\rho a^2m$ as potential energy, and $U$ as total energy. The equation can be understood as the conservation of the total energy ($U$). $U$ is therefore a constant.
If you multiply both sides by $\frac{2}{ma^2}$, you got:
$$
\frac{2U}{ma^2}=\frac{\dot{a}^2}{a^2}-\frac{8\pi}{3}G\rho,
$$
which yields:
$$
\frac{\dot{a}^2}{a^2}=\frac{8\pi}{3}G\rho + \frac{2U}{ma^2}.
$$
If you define
$$
k=\frac{-2U}{mc^2}
$$
The previous equation reduces to the final Friedman equation:
$$
\frac{\dot{a}^2}{a^2}=\frac{8\pi}{3}G\rho - \frac{kc^2}{a^2}.
$$
The zero total energy $U=0$ implies $k=0$ which means flat space (not flat space-time! $k$ in the FLRW metric is only related to space curvature, not space-time curvature.).
Currently, all observations point to zero $U$ or $k$. The flatness of the universe is one of the basic assumptions of the standard cosmology  $\Lambda$CDM model.
The underlying cause for the flatness hasn't been fully settled so far. The inflation hypothesis purportedly proffers an explanation. But is everyone convinced? Probably not.
A: NEWTON
the energy is:
$$\frac{1}{2} \dot{a}^2+V(a)=E\tag 1$$
where $V(a)$ is the potential energy and $\frac{1}{2} \dot{a}^2$  the kinetic energy.
you can describe equation (1) using the Habbel parameter $H=\frac{\dot a}{a}$
$$H^2-\frac{2E}{a^2}=\frac{8\pi\,G}{3}\,\epsilon\tag 2$$
where $\epsilon$ is the energy density
with equation (1) in (2) you  obtain for $V(a)$
$$V(a)=-\frac{8\pi\,G}{6}\,a^2\,\epsilon$$
EINSTEIN
The Friedmann equation is:
$$H^2+\frac{k}{a^2}=\frac{8 \pi\,G}{3}\,\epsilon\tag 3$$
compare equation (2) with (3) you obtain for $k$
$$k=-2\,E$$

More details  you find in v. MUKHANOV book "  Physical Foundations of Cosmology"
