How does one derive the Einstein Field Equations? I've been trying to teach myself General Relativity recently, I've came across two problems whisled doing so; I don't really understand why $R=g^{\mu\nu}R_{\mu\nu}$, why couldn't I contract the indices with a different two index tensor eg. $R=\gamma^{\mu\nu}R_{\mu\nu}$, and I don't understand how the Einstein Field Equations are derived. I've searched online and most people derive it by using the Einstein-Hilbert action, but my understanding on Calculus of Variations is a bit shakey and I don't understand what Einstein and Hilbert were trying to minimise. So if you can explain an easy way of deriving the Einstein Field Equations or explain the Einstein-Hilbert action and deriving the equations through it that will be much appreciated.
 A: Once the geometric context of gravity is clear (which is really kind of independent of the specific field equations), one can reason as follows.
The field equation must reduce to the field equation of Newtonian gravity, which is $$ \nabla^2\phi=\kappa\rho, $$ where $\rho$ is the density of the source ($\kappa$ is an irrelevant constant).
We know from special relativity, that mass/energy density is by itself not a scalar quantity, but (in $c=1$ units) is the $00$ component of the stress-energy tensor, $\rho=T^{00}$.
If we want a geometric description and the equivalence principle, then particles moving under the effects of solely gravity must obey the geodesic equation, which is $$ \frac{d^2\gamma^\mu}{d\tau^2}=-\Gamma^\mu_{\kappa\lambda}\frac{d\gamma^\kappa}{d\tau}\frac{d\gamma^\lambda}{d\tau}. $$
In the nearly flat spacetime ($g_{\mu\nu}=\eta_{\mu\nu}+h_{\mu\nu}$) and slow particle ($d\gamma^0/d\tau$ dominates over the spatial components) we get $$ \frac{d^2\gamma^\mu}{d\tau^2}=-\Gamma^\mu_{00}\left(\frac{d\gamma^0}{d\tau}\right)^2, $$ where in this limit the connection is $\Gamma^\mu_{00}=\frac{1}{2}\eta^{\mu\rho}(2\partial_0h_{0\rho}-\partial_\rho h_{00})$. We further assume that the metric doesn't change in time (Newtonian gravitation has no time evolution), then we get $$ \frac{d^2\gamma^\mu}{d\tau^2}=\frac{1}{2}\left(\frac{d\gamma^0}{d\tau}\right)^2\partial^\mu h_{00}. $$
Due to staticness, the 0 component of this equation is just $d^2\gamma^0/d\tau^2=0$, which means that $d\gamma^0/d\tau$ is constant, so we can divide by its square (and use that $\gamma^0$ is basically the $t$ coordinate time), we get $$ \frac{d^2\gamma^i}{dt^2}=\frac{1}{2}\partial_i h_{00}, $$ which is the equation of motion in a Newtonian gravitational field if $h_{00}=-2\phi$.
So going back to the Poisson equation $\nabla^2\phi=\kappa\rho$, we know that $\rho=T^{00}$, and $\phi$ is related to $h_{00}$ and as such to $g_{00}$, and second derivatives of $\phi$ appear, so the Newtonian equation has the form $$ K^{00}=\kappa T^{00}, $$ but we want a tensorial equation, so the full gravitational equation should be $$ K^{\mu\nu}=\kappa T^{\mu\nu}, $$ where $K^{\mu\nu}$ is some kind of tensor field constructed out of the metric's second derivatives.
But we know from differential geometry, that all tensor fields depending on the metric's second derivatives are derived from $ R^\kappa_{\ \lambda\mu\nu} $, the curvature tensor.
There are not many second-rank tensors that can be made of this, one of them is $R^{\mu\nu}$ the Ricci tensor. Here we could also look at the Ricci tensor's Newtonian limit to see how it is related to $h_{00}$ but I don't want to do that here.
Unfortunately $K^{\mu\nu}$ cannot be proportional to $R^{\mu\nu}$ because the stress energy tensor must satisfy $\nabla_\nu T^{\mu\nu}=0$, but we have $$ \nabla_\nu R^{\mu\nu}=\frac{1}{2}\nabla^\mu R $$ from the Bianchi identity, so by rearranging we get $$ \nabla_\nu R^{\mu\nu}=\frac{1}{2}g^{\mu\nu}\nabla_\nu R \\ \nabla_\nu\left(R^{\mu\nu}-\frac{1}{2}g^{\mu\nu}R\right)=\nabla_\nu G^{\mu\nu}=0, $$ eg. the Einstein tensor $G^{\mu\nu}$ is automatically divergenceless. So we should have $$ G^{\mu\nu}\sim T^{\mu\nu}, $$ which is the Einstein field equation. 
A: As it was already mentioned in the comments, deriving Einstein's field equations needs a good foundation in differential geometry. But anyway, I will try to give a more physical intuitive explanation which might help you understand something about "the way to the field equations". 
First we want to review classical fields. A field associates each point in space with a physical quantity mathematically expressed as a scalar, vector or tensor. Now one might ask: What's the source of the field? From classical mechanics or electromagnetism, we now that the source of a gravitational or electric field is the mass or charge distribution abbreviated as $\varrho$. The remaining question is: How do we get a mathematical expression of a field for a given $\varrho$? The answer (which can be obtained by doing some math): Solve Poisson's equation. That is, find solutions for
$$\Delta \Phi = 4\pi \varrho.$$
So now imagine we are in 1905. A young physicist named Albert Einstein publishes a new theory, called special relativity. His theory is based on two postulates:


*

*The speed of light is constant in all inertia systems.

*The physical laws are the same in all inertial systems.


What has this to do with fields? Special relativity shows that electrostatic and magnetic fields are basically the same, they depend on the frame of reference.
Now Einstein begins to wonder if there is a way to incorporate gravity into this new "relativity" framework. He begins to think: Imagine a man in an elevator. If the elevator rests on earth, the man feels the gravitational force that pulls him onto the ground. But if the elevator is somewhere in outer space and accelerating a force would pull the man to the elevator's floor. The consequences: If the elevator has no windows, the man is not able to distinguish between the gravitational force of earth and the acceleration of the elevator in a "gravity-free" space.
But as fate has it, gravitation proves to be quite difficult to incorporate into relativity, so after years of thinking and mathematical hardship (which mostly involves differential geometry, multilinear algebra and topology), Einstein comes up with an idea: Gravitation is a consequence of the curvature of spacetime. The curvature itself is induced by mass. He comes up with an equation:
$$R^a{}_{bcd} = 4 \pi \varrho_m.$$
What he did was to substitute the so called Riemannian curvature tensor for $\Delta \Phi$. Now  form special relativity, he knew that energy is equivalent to mass (remember $E = mc^2$). So instead of using the mass distribution, he came up with the stress-energy-tensor $T_{ab}$. So the field equations become
$$R^a{}_{bcd} = 4\pi T_{ab}.$$
It basically tells out that mass is the curvature of spacetime, which seems fine, right? But it isn't. This equations disregard the continuity equation. So another year of hard work (again a lot of math was involved) was needed for him to derive  the final result in 1915:
$$R_{ab} - \frac{1}{2}g_{ab} R = 8 \pi T_{ab}.$$
Here $R_{ab}$ is the Ricci curvature tensor (obtained by contraction of the Riemannian tensor), $R$ is the curvature scalar (obtained by anther contraction of the Riemannian tensor) and $g_{ab}$ is the metric. 
I hope I could shed at least a bit of light on your issue. A formal derivation of the field equations involves lot of advanced math (remember Einstein needed several year to get a grasp of it), but nevertheless, there is some analogy between classical fields and general relativity.
