From An Introduction to Manifolds by Tu:
Let $g(t) = f(p + t (x-p))$ where $x,p \in \Bbb R^n$ and $t \in \Bbb R$.
Then $\frac{d}{dt}f(p + t(x-p)) = \sum(x_i-p_i)\frac{\partial f}{\partial x_i}(p + t(x-p))$
How is this derivative derived? Where does the sum come from and all the other partial derivatives?
This is about the multivariable chain rule. Here I'll take $n=2$ as an example to explain the derivative equation. For convenience, I assume the derivatives of $f$ is continuous, although this assumption is not neccessary. Actually, the differentiability of $f$ will be enough, see here for example.
In this case, $g(t)=f(p_1+t(x_1-p_1),p_2+t(x_2-p_2))$. Thus \begin{align*} \frac{g(t)-g(t_0)}{t-t_0}&=\frac{f(p_1+t(x_1-p_1),p_2+t(x_2-p_2))-f(p_1+t_0(x_1-p_1),p_2+t_0(x_2-p_2))}{t-t_0}\\&=\frac{f(p_1+t(x_1-p_1),p_2+t(x_2-p_2))-f(p_1+t_0(x_1-p_1),p_2+t(x_2-p_2))}{[p_1+t(x_1-p_1)]-[p_1+t_0(x_1-p_1)]}\cdot(x_1-p_1)\\&+\frac{f(p_1+t_0(x_1-p_1),p_2+t(x_2-p_2))-f(p_1+t_0(x_1-p_1),p_2+t_0(x_2-p_2))}{[p_2+t(x_2-p_2)]-[p_2+t_0(x_2-p_2)]}\cdot(x_2-p_2). \end{align*} Letting $t\to t_0$ and using the continuity of $f'_2$ gives the desired result.