Suppose now the Lagrangian $L$ is a function of $y(x), y'(x)$ and also $y''(x)$, i.e. it contains second derivatives w/r to the parameter $x$.
It is straightforward to adapt the
usual procedure to this case: write
\begin{align}
Y(x,\epsilon)=y(x)+\epsilon\,\eta(x)
\end{align}
for an otherwise arbitrary function $\eta$.
We then have the parametrized integral
\begin{align}
I(\epsilon)=\displaystyle
\int_a^b\,dx\,L(x,Y(x,\epsilon),Y'(x,\epsilon),
Y''(x,\epsilon))
\end{align}
and we want to find $L$ at $\epsilon=0$
so that
\begin{align}
0&=\frac{dI}{d\epsilon}\vert_{\epsilon=0}\, ,\\
&=\displaystyle\int_a^b\,dx\,
\left(
\frac{\partial L}{\partial Y}
\frac{\partial Y}{\partial \epsilon}+
\frac{\partial L}{\partial Y'}\frac{\partial Y'}{\partial \epsilon}
+\frac{\partial L}{\partial Y''}\frac{\partial Y''}{\partial \epsilon}
\right)\vert_{\epsilon=0}\, ,\\
&=\displaystyle\int_a^b\,dx\,
\left(
\frac{\partial L}{\partial y}\eta
+\frac{\partial L}{\partial y'}\eta'
+\frac{\partial L}{\partial y''}
\eta'' \right)\, .
\end{align}
We need to turn around the terms in
$\eta'$ and $\eta''$. A first integration
by parts will do this:
\begin{align}
\displaystyle\int_a^b\,dx\,
\frac{\partial F}{\partial y'}\frac{d\eta}{dx}
&=\frac{\partial F}{\partial y'}\eta(x)\Bigl\vert_a^b-
\displaystyle\int_a^b\,dx\,\eta
\frac{d}{dx}\left(\frac{\partial F}{\partial y'}\right)\, ,\\
\displaystyle\int_a^b\,dx\,
\frac{\partial F}{\partial y''}
\frac{d\eta'}{dx}&=
\frac{\partial F}{\partial y''}\eta'(x)
\Bigl\vert_a^b-
\displaystyle\int_a^b\,dx\,\eta'
\frac{d}{dx}\left(\frac{\partial F}{\partial y''}\right)\, .
\end{align}
We assume now that the function $\eta$ is
chosen so that $\eta(b)=\eta(a)=0$ as before.
In addition, we must also assume
that $\eta'(b)=\eta'(a)=0$, a new condition.
In this way we have
\begin{align}
\displaystyle\int_a^b\,dx\,
\frac{\partial L}{\partial y'}\eta'&=
-\displaystyle\int_a^b\,dx\,\eta\,
\frac{d}{dx}
\left(\frac{\partial L}{\partial y'}\right)\, ,\\
\displaystyle\int_a^b\,dx\,
\frac{\partial L}{\partial y''}\eta''&=
-\displaystyle\int_a^b\,dx\,\eta'\,
\frac{d}{dx}\left( \frac{\partial L}{\partial y''}\right)\, .
\end{align}
We still need to turn $\eta'$ around one last time. Using integration by parts again:
\begin{align}
-\displaystyle\int_a^b\,dx\,\eta'
\frac{d}{dx}\left(\frac{\partial F}{\partial y''}\right)= + \displaystyle\int_a^b\,dx\,
\eta\,\frac{d^2}{dx^2}\left(\frac{\partial F}{\partial y''}\right)
\end{align}
where the boundary condition $\eta(b)=\eta(a)$ has been used to eliminate the boundary term.
Thus, putting all this together, we get
\begin{align}
0=\frac{dI}{d\epsilon}\Bigl\vert_{\epsilon=0}
=\displaystyle\int_a^b \,dx\,\eta\,
\left(\frac{d^2}{dx^2}\left(\frac{\partial F}{\partial y''}\right)-\frac{d}{dx}
\left(\frac{\partial F}{\partial y'}\right)
+\frac{\partial F}{\partial y}\right)\, .
\end{align}
Since $\eta$ is arbitrary (up to the boundary conditions), we find therefore the function
$L$ must satisfy the differential equation
\begin{align}
0=\frac{d^2}{dx^2}\left(
\frac{\partial L}{\partial y''}\right)-
\frac{d}{dx}\left(\frac{\partial L}{\partial y'}\right)+\frac{\partial L}{\partial y}\, .
\end{align}
The generalization to $L$ containing yet
more derivatives is obvious: for
a the derivative of order $k$ we obtain a
sign $(-1)^k$ as we need $k$ integrations
by parts. Thus, we obtain the generalized
Euler-Lagrange equation in the form
\begin{align}
0&=\sum_{k}(-1)^k\frac{d^k}{dx^k}
\left(\frac{\partial L}{\partial y^k}\right)
\equiv E(L)\, ,\\
E&=\sum_k (-1)^k \frac{d^k}{dx^k}
\frac{\partial }{\partial y^k}\, .
\end{align}
There's some discussion of this (including how to properly define a conjugate momentum) in the following:
Riahi, F. "On Lagrangians with higher order derivatives." American Journal of Physics 40.3 (1972): 386-390.
and also in
Borneas, M. "On a generalization of the Lagrange Function." American Journal of Physics 27.4 (1959): 265-267.
Yes, OP is right. In the field-theoretic case, the partial derivatives in OP's first formula (1) should be replaced with functional derivatives
$$ \delta S~=~\int_{t_1}^{t_2}\!\mathrm{d}t\left(\frac{\delta L}{\delta q}~\delta q+\left. \frac{\delta L}{\delta v}\right|_{v=\dot{q}}~\delta \dot{q}\right),\tag{1'}$$
where the Lagrangian
$$L[q(\cdot,t),v(\cdot,t);t]~=\int \! \mathrm d^3x~ {\cal L}(q(x,t),v(x,t), ~\partial_x q(x,t), \partial_x v(x,t),~\ldots , t) $$
is a functional. The ellipsis $\ldots$ indicates dependence of possible higher-order derivatives. See my Phys.SE answers here and here for further details.
Best Answer
The Euler-Lagrange equations in the case of explicitly time dependent Lagrangian are the same as the ones without explicit time dependence. You are getting mixed up with what is getting varied and how the variation should be carried out.
Approach 1. You do not vary time. This is because you want to find how the configuration $q \in \mathbb{R}^n$ of your system evolves in time $t \in \mathbb{R}$, so you are looking for a map $$ q : [t_1, t_2] \to \mathbb{R}^n$$ that describes this time evolution, starting at point $q_1$ and ending at point $q_2 \in \mathbb{R}^n$. So Lagrangian mechanics tells you that you want to find a curve of the form $$\gamma = \Big\{ \, \big(\,t, \,q(t) \,\big) \, \in \, \mathbb{R} \times \mathbb{R}^n\,\, :\, \, t \in [t_1, t_2] \Big\}$$, such that $q(t_1) = q_1$ and $q(t_2) = q_2$, that optimizes the action functional $$S[\gamma] = \int_{t_1}^{t_2}\, L\Big( q(t), \, \frac{d q}{dt}(t), \, t\Big) \,dt$$ defined for any smooth curve $\gamma$ of the form written above. Then if you get any two such curves $\gamma = \Big\{ \, \big(\,t, \, q(t)\, \big) \, : \, t \in [t_1, t_2] \, \Big\}$ and $\tilde\gamma = \Big\{ \, \big(\,t, \, \tilde q(t)\, \big) \, : \, t \in [t_1, t_2] \, \Big\}$ between the points $q_1$ and $q_2$, then there exist one parameter family of such curves $$\gamma_{\epsilon} = \Big\{ \, \big(\,t, \, q(t, \epsilon)\, \big) \, : \, t \in [t_1, t_2] \, \Big\}$$ where $q(t, 0) = q(t)$ and $q(t,1) = \tilde q(t)$. So basically this tells you that any two curves of the form $\gamma_{\epsilon} = \Big\{ \, \big(\,t, \, q(t, \epsilon)\, \big) \, : \, t \in [t_1, t_2] \, \Big\}$, among which is the solution you are interested in, can be included into a one parameter family (a variation) of the type $$\gamma_{\epsilon} = \Big\{ \, \big(\,t, \, q(t, \epsilon)\, \big) \, : \, t \in [t_1, t_2] \, \Big\}$$ So the curves that optimize the action $S[\gamma]$ are among the critical points of $S[\gamma]$. The critical points of $S[\gamma]$ are the zeroes of its derivative. To find the derivative of $S[\gamma]$ you have to take an arbitrary family $\gamma_{\epsilon}= \Big\{ \, \big(\,t, \, q(t, \epsilon)\, \big) \, : \, t \in [t_1, t_2] \, \Big\}$ that connects $q_1$ to $q_2$ and take $$\frac{\partial}{\partial \epsilon}\, S[\gamma_{\epsilon}] \Big|_{\epsilon = 0}$$ i.e. first differentiate with respect to $\epsilon $ and then set $\epsilon = 0$. Thus, in order to find the critical curves $\gamma$ of the functional $s[\gamma]$, you want to find those $\gamma = \Big\{ \, \big(\,t, \, q(t)\, \big) \, : \, t \in [t_1, t_2] \, \Big\}$ between $q_1$ and $q_2$ for which \begin{align} 0 = \delta S[\gamma] =& \frac{\partial}{\partial \epsilon}\, S[\gamma_{\epsilon}] \Big|_{\epsilon = 0} = \frac{\partial}{\partial \epsilon}\, \int_{t_1}^{t_2}\, L\Big( q(t, \epsilon), \, \frac{d q}{dt}(t, \epsilon), \, t\Big) \,dt \, \Big|_{\epsilon = 0} = \\ =& \int_{t_1}^{t_2}\, \frac{\partial}{\partial \epsilon}\, L\Big( q(t, \epsilon), \, \frac{d q}{dt}(t, \epsilon), \, t\Big) \,dt \, \Big|_{\epsilon = 0} = \\ =& \int_{t_1}^{t_2}\, \left( \,\frac{\partial L}{\partial q^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} + \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial}{\partial \epsilon} \frac{d q^k}{dt} \,\right) \,dt \, \Big|_{\epsilon = 0} = \\ =& \int_{t_1}^{t_2}\, \left( \,\frac{\partial L}{\partial q^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} + \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{d}{dt} \frac{\partial q^k}{\partial \epsilon} \,\right) \,dt \, \Big|_{\epsilon = 0} = \\ \end{align} By the product rule of derivatives $$\frac{d}{dt}\left(\, \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} \,\right) = \left(\, \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \right)\, \frac{\partial q^k}{\partial \epsilon} + \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{d}{dt} \frac{\partial q^k}{\partial \epsilon}$$ and therefore $$ \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{d}{dt} \frac{\partial q^k}{\partial \epsilon} = - \left(\, \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \right)\, \frac{\partial q^k}{\partial \epsilon} + \frac{d}{dt}\left(\, \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} \,\right) $$ Also, when you set $\epsilon =0$ then $$\delta q^k(t) = \frac{\partial q^k}{\partial \epsilon}(t, \epsilon)\Big|_{\epsilon =0}$$ and you get the expression \begin{align} 0 = \delta S[\gamma] =& \frac{\partial}{\partial \epsilon}\, S[\gamma_{\epsilon}] \Big|_{\epsilon = 0} = \frac{\partial}{\partial \epsilon}\, \int_{t_1}^{t_2}\, L\Big( q(t, \epsilon), \, \frac{d q}{dt}(t, \epsilon), \, t\Big) \,dt \, \Big|_{\epsilon = 0} = \\ =& \int_{t_1}^{t_2}\, \left( \,\frac{\partial L}{\partial q^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} + \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{d}{dt} \frac{\partial q^k}{\partial \epsilon} \,\right) \,dt \, \Big|_{\epsilon = 0} = \\ =& \int_{t_1}^{t_2}\, \left( \,\frac{\partial L}{\partial q^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} - \left(\, \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \right)\, \frac{\partial q^k}{\partial \epsilon} + \frac{d}{dt}\left(\, \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} \,\right) \,\right) \,dt \, \Big|_{\epsilon = 0} = \\ =& \int_{t_1}^{t_2}\, \left( \,\frac{\partial L}{\partial q^k}\Big( q(t), \, \dot{q}(t), \, t\Big) \delta q^k(t) - \left(\, \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q(t), \, \dot{q}(t), \, t\Big) \right)\, \delta q^k(t) \right)\, dt +\\ &+ \int_{t_1}^{t_2}\, \frac{d}{dt}\left(\, \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} \,\right) \,dt \, \Big|_{\epsilon = 0} = \\ =& \int_{t_1}^{t_2}\, \left( \,\frac{\partial L}{\partial q^k}\Big( q(t), \, \dot{q}(t), \, t\Big) \delta q^k(t) - \left(\, \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q(t), \, \dot{q}(t), \, t\Big) \right)\, \delta q^k(t) \right)\, dt + 0 = \\ =& \int_{t_1}^{t_2}\, \left( \,\frac{\partial L}{\partial q^k}\Big( q(t), \, \dot{q}(t), \, t\Big) - \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q(t), \, \dot{q}(t), \, t\Big) \,\right)\,\delta q^k(t) dt \end{align} which has to hold for any arbitrary smooth curve $\delta q(t)$. This is possible if and only if $$\frac{\partial L}{\partial q^k}\Big( q(t), \, \dot{q}(t), \, t\Big) - \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q(t), \, \dot{q}(t), \, t\Big) = 0$$ for all $k=1, ..., n$. In other words, a curve $\gamma = \Big\{\,(\, t, \, q(t)\,) \, : \, t \in [t_1,t_2]\,\Big\}$ connecting $q_1$ to $q_2$ is a critical curve for the action $S[\gamma]$, i.e. $$\delta S[\gamma] = 0$$ if and only if it satisfies the system of differential equations $$ \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \frac{dq}{dt}, \, t\Big) = \frac{\partial L}{\partial q^k}\Big( q, \, \frac{dq}{dt}, \, t\Big) $$ for $k=1, ..., n$. The latter system of differential equations is exactly the system of Euler-Lagrange equations.
Approach 2. To find the evolution of your system, you may parametrize the curves $\gamma = \Big\{\,(\, t, \, q(t)\,) \, : \, t \in [t_1,t_2]\,\Big\}$ in terms of another parameter $s \in \mathbb{R}$ and so time becomes $t=t(s)$ your evolution becomes $q(s) = q(t(s))$. Consequently, the curves you are dealing with are of the more general form $\gamma = \Big\{\,(\, t(s), \, q(s)\,) \, : \, s \in [s_1,s_2]\,\Big\}$. But then $$\frac{dq^k}{dt}(t) = \frac{dq^k}{ds}(s)\frac{ds}{dt}(t) =\frac{\,\, \frac{dq^k}{ds}(s)\,\,}{\frac{dt}{ds}(s)} = \Big(\, \frac{dt}{ds}(s)\,\Big)^{-1} \frac{d q^k}{ds}(s)$$ and $$dt = \frac{dt}{ds}(s)\, ds$$ and therefore, the action becomes $$S[\gamma] = \int_{t_1}^{t_2}\, L\Big( q(t), \, \frac{d q}{dt}(t), \, t\Big) \,dt = \int_{s_1}^{s_2}\, L\left( q(s), \, \frac{d q}{ds}(s)\, \Big(\,\frac{dt}{ds}(s)\,\Big)^{-1}, \, t(s) \,\right) \,\frac{dt}{ds}(s)\, ds = $$ $$= \int_{s_1}^{s_2}\, \tilde{L}\left(\, q(s), \, t(s), \, \frac{d q}{ds}(s), \, \frac{d t}{ds}(s)\,\right) \,ds$$ where the new Lagrangian $\tilde L$ is $$\tilde{L}\left(\, q, \, t, \, \frac{d q}{ds}, \, \frac{d t}{ds}\,\right) = L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \,\frac{dt}{ds} $$ Observe that this last function $\tilde L$ is not explicitly dependent on the new variable $s$, so the critical curves should satisfy the usual Euler-Lagrange equations but this time with respect to the variable $s$ and with one extra equation for $t$. However, if you invert the function $t=t(s)$, turning it into $s=s(t)$, you will eliminate $s$ and you will end up with the same Euler-Lagrange equations which I derived in Approach 1 plus one extra equation for $t$, decoupled from them. So you drop it and you arrive at the same result as Approach 1.
Indeed, the Euler Lagrange equations for $\tilde L$ are \begin{align} &\frac{d}{ds}\, \frac{\partial \tilde{L}}{\partial q^{'k}}\Big(\,q, t, \frac{d q}{ds}, \frac{dt}{ds} \,\Big) = \frac{\partial \tilde{L}}{\partial q^k}\Big(\,q, t, \frac{d q}{ds}, \frac{dt}{ds} \,\Big)\\ &\frac{d}{ds}\, \frac{\partial \tilde{L}}{\partial t'}\Big(\,q, t, \frac{d q}{ds}, \frac{dt}{ds} \,\Big) = \frac{\partial \tilde{L}}{\partial t}\Big(\,q, t, \frac{d q}{ds}, \frac{dt}{ds} \,\Big) \end{align} for $k = 1, ..., n$. Now plug in the expression for $\tilde L$ in terms of $L$ and carefully carry out all the chain rule differentiation and you get \begin{align} &\frac{d}{ds}\left( \frac{\partial }{\partial q^{'k}} \,\left[L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\frac{dt}{ds}\right] \right) = \frac{\partial }{\partial q^k}\left[ L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds}\right]\\ &\frac{d}{ds}\left( \frac{\partial }{\partial t'} \,\left[L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\frac{dt}{ds}\right] \right) = \frac{\partial }{\partial t}\left[ L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds}\right] \end{align} where $q^{'k}$ is a short notation for $\frac{dq^k}{ds}$. First, by applying chain rule and carrying out the differentiation, we get \begin{align} &\frac{d}{ds}\left( \frac{\partial L}{\partial \dot{q}^j}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\frac{dt}{ds} \, \frac{\partial }{\partial q^{'k}}\left[\Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q^j}{ds}\right]\,\right) = \frac{\partial L}{\partial q^k}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds}\\ &\frac{d}{ds}\left( \frac{\partial L}{\partial \dot{q}^j}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\frac{dt}{ds} \frac{\partial}{\partial t'}\left[\Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q^j}{ds}\right] + L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\,\right) = \\&= \frac{\partial L}{\partial t}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds} \end{align} and then the equations simplify to \begin{align} &\frac{d}{ds}\left( \frac{\partial L}{\partial \dot{q}^k}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\frac{dt}{ds} \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\right) = \frac{\partial L}{\partial q^k}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds}\\ &\frac{d}{ds}\left(-\, \frac{\partial L}{\partial \dot{q}^j}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\frac{dt}{ds} \Big(\,\frac{dt}{ds}\,\Big)^{-2}\frac{d q^j}{ds} + L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\,\right) = \\&= \frac{\partial L}{\partial t}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds} \end{align} and after that we get \begin{align} &\frac{d}{ds}\left( \frac{\partial L}{\partial \dot{q}^k}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\, \right) = \frac{\partial L}{\partial q^k}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds}\\ &\frac{d}{ds}\left(-\, \frac{\partial L}{\partial \dot{q}^j}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q^j}{ds}, \, t \,\right) \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q^j}{ds} + L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\,\right) = \\&= \frac{\partial L}{\partial t}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds} \end{align} Since $\Big(\frac{dt}{ds}\Big)^{-1} = \frac{ds}{dt}$, we can multiply both side of the equations by $\Big(\frac{dt}{ds}\Big)^{-1}$ and obtain \begin{align} &\frac{ds}{dt}\frac{d}{ds}\left( \frac{\partial L}{\partial \dot{q}^k}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\, \right) = \frac{\partial L}{\partial q^k}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\\ &\frac{ds}{dt}\frac{d}{ds}\left(-\, \frac{\partial L}{\partial \dot{q}^j}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q^j}{ds} + L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\,\right) = \\&= \frac{\partial L}{\partial t}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \end{align} Finally, invert the function $t=t(s)$ into $s=s(t)$ and recall that then $\frac{ds}{dt} \frac{d}{ds} = \frac{d}{dt}$ and $\Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q^k}{ds} = \frac{d q^k}{dt}$. Now, we arrive at the equations \begin{align} &\frac{d}{dt}\left( \frac{\partial L}{\partial \dot{q}^k}\left( q, \, \frac{d q}{dt}, \, t \,\right)\, \right) = \frac{\partial L}{\partial q^k}\left( q, \, \frac{d q}{dt}, \, t \,\right)\\ &\frac{d}{dt}\left(-\, \frac{\partial L}{\partial \dot{q}^j}\left( q, \, \frac{d q}{dt}, \, t \,\right) \frac{d q^j}{dt} + L\left( q, \, \frac{d q}{dt}, \, t \,\right)\,\right) = \frac{\partial L}{\partial t}\left( q, \, \frac{d q}{dt}, \, t \,\right) \end{align} The first system of equations are the Euler-Lagrange equations for $k = 1, ..., n$. The last equation is in fact the evolution of the total energy of the system. When $L$ does not depend on $t$ explicitly, the right hand side of this last equation is zero and we end up with the conservation of energy of the system.