Let $M$ be a manifold, and $\gamma: [s_0, s_1]\to M$ be a curve on $M$ such that the length of the curve
$$
l = \int_{s_0}^{s_1}\sqrt{g_{\mu\nu}(s)\frac{d\gamma^\mu}{ds}\frac{d\gamma^\nu}{ds}} ds \quad \text{where } g_{\mu\nu}(s) \equiv g_{\mu\nu}(\gamma^\rho(s))
$$
is minimal. Such a curve is known as a geodesic. One can now use variational calculus to calculate the explicit form of such a curve for a given metric $g_{\mu\nu}$. The resulting Euler-Lagrange equations are then known as the geodesic equations, and takes the form
$$\tag{1}
\frac{d^2\gamma^\rho}{ds^2} + \Gamma^\rho{}_{\mu\nu}\frac{d\gamma^\mu}{ds}\frac{d\gamma^\nu}{ds} = 0
$$
The symbol $\Gamma^\rho{}_{\mu\nu}$ is known as the Christoffel symbol and encodes information about how the manifold curves along the path. It is calculated from first derivatives of the metric as
$$
\Gamma^\rho{}_{\mu\nu} = \frac{1}{2}g^{\rho\sigma}\left(\frac{d}{dx^\mu}g_{\sigma\nu} + \frac{d}{dx^\nu}g_{\mu\sigma} - \frac{d}{dx^\sigma}g_{\mu\nu}\right)
$$
But usually this does not have to be explicitly computed, since the variational method gives the geodesic equations directly. According to the theory of general relativity, particles experiencing only gravitational interactions move along geodesics through the spacetime manifold. However, the metric on the spacetime manifold carries a Lorentzian signature. This means that in a basis where the metric is diagonal, the line element takes the form
$$
ds^2 = g_{\mu\nu}dx^\mu dx^\nu = -A\,dx_0^2 + B\,dx_1^2 + C\,dx_2^2 + D\,dx_3^2
$$
Where $A, B , C$ and $D$ are (smooth) functions of the spacetime coordinates. Note that the first summand has a negative sign. This means that there are curves on the manifold for which the line element vanishes, even though the coefficients $A,B,C,D$ do not along the entire curve. Such curves are known as null curves or lightlike curves, since massless particles (such as photons, but also gluons or gravitational waves) travel along such curves. So to calculate which path light takes for a given metric, one needs to calculate the null geodesics of the manifold, that is, find solutions $\gamma(s)$ of equation $(1)$ so that
$$
g_{\mu\nu}(s)\frac{d\gamma^\mu}{ds}\frac{d\gamma^\nu}{ds} = 0
$$
for all $s \in [s_0,s_1]$. Of course, this requires suitable initial conditions to arrive at a unique solution and is in general very difficult. For special spacetimes with additional symmetries (like the Schwarzschild spacetime) or nearly flat space, the computations can simplify significantly. One can use the exact same procedure to find the equations of motion for massive particles in the absence of non-gravitational interactions: Those move along timelike geodesics, for which we instead have
$$
g_{\mu\nu}(s)\frac{d\gamma^\mu}{ds}\frac{d\gamma^\nu}{ds} = -1
$$
where the $-1$ is a convenient normalization. Any negative real number would yield the same curve, with a different parametrization.