In response to a Quora question, I wrote the following:

Given two Lagrangians that differ only by a full time derivative, i.e.,


the difference in their variation will be given by:

$$\delta L'-\delta L=\delta\frac{d}{dt}F(q,\dot{q},t),$$

which, as the variation and the derivative operator commute, is equal to

$$\delta L'-\delta L=\frac{d}{dt}\delta F(q,\dot{q},t).$$

The variation of the action is given by $\delta S=\int\delta L~dt$. The difference in the variation of the action, then, will be

$$\delta S'-\delta S=\int_{t_1}^{t_2}\frac{d}{dt}\delta F(q,\dot{q},t)~dt.$$

Given that the integrand is a full time derivative, the integration can be trivially carried out:

$$\delta S'-\delta S=\delta F(q,\dot{q},t)\bigg|_{t_1}^{t_2}.$$

The nature of the variational problem is such that the variation vanishes at the endpoints of the integration by definition. So $\delta F(q(t_1),\dot{q}(t_1),t_1)=\delta F(q(t_2),\dot{q}(t_2),t_2)=0.$ Therefore,

$$\delta S'-\delta S=0,$$

and the Euler-Lagrange equations that correspond to $L$ and $L'$ will be the same. I.e., the two Lagrangians lead to identical equations of motion.