In van Brunt's "The Calculus of Variations" the author derives the Euler-Lagrange equation. To start, the author notes that the first variation $\delta J(\eta, y)$ of a functional $J: C^2[x_0,x_1] \to \mathbb{R}$ can be written as
$$ \int_{x_0}^{x_1} \eta \biggl( \frac{\partial f}{\partial y} - \frac{d}{dx}\biggl(\frac{\partial f}{\partial y'}\biggr)\biggr)dx = 0. \tag{1}$$
The author then rewrites the integrand as
$$\frac{\partial f}{\partial y} - \frac{d}{dx}\biggl(\frac{\partial f}{\partial y'}\biggr) = \frac{\partial f}{\partial y} - \frac{\partial^2 f}{\partial x \partial y'} - \frac{\partial^2 f}{\partial y \partial y'}y' - \frac{\partial^2 f}{\partial y'\partial y'}y''. \tag{2}$$
Where does (2) come from? I can't figure out how the author is getting the third and fourth terms on the right-hand-side of the equation.
In general we consider functionals of the form $J[y] = \int_a^\beta f(x,y,y') \; \mathrm dx$. So $f$, and thus $\frac{\partial f}{\partial y'}$ may be a function of $x$, $y$ and $y'$. Here, $\frac{\mathrm d}{\mathrm dx}$ is the total derivative and can be calculated by $$\frac{\mathrm d}{\mathrm dx} = \frac{\partial}{\partial x} + \frac{\partial}{\partial y}y' + \frac{\partial}{\partial y'}y'',$$ which is a simple consequence of the chain rule. Note that $\frac{\mathrm d}{\mathrm dx}$ is not the same as $\frac{\partial}{\partial x}$. So, we have that \begin{align*} \frac{\mathrm d}{\mathrm dx} \left(\frac{\partial f}{\partial y'}\right) &= \frac{\partial}{\partial x} \left(\frac{\partial f}{\partial y'}\right) + \frac{\partial}{\partial y}\left(\frac{\partial f}{\partial y'}\right) y' + \frac{\partial}{\partial y'} \left(\frac{\partial f}{\partial y'}\right) y'' \\ &= \frac{\partial^2 f}{\partial x \partial y'} + \frac{\partial^2 f}{\partial y \partial y'}y' + \frac{\partial^2}{\partial y'\partial y'}y'', \end{align*} which agrees with the author's expression.