Detailed conditions for symmetries of Lagrangian Edit: To clarify the question, I am asking why we are justified in calling a continuous symmetry a symmetry of a system when it changes the Lagrangian by a total derivative of a function of $t, q(t)$ and $\dot{q}(t)$. As stated below, it is not clear to me that this would leave the equations of motion unchanged. A simple example from elementary physics is time translation $t \to t + \delta t$, whence $\delta L \propto dL/dt$ (in the infinitesimal case). The references to Noether's theorem are to give context to the question.
Edit 2: To emphasize (thanks to @Qmechanic), my question is about the common statement, for example found on p. 17 of Peskin and Schroeder but generic, that if $L$ changes by a total time derivative of some $F(t,q,\dot{q})$ under a symmetry, then that symmetry is a symmetry of the problem. I do not see how this follows when $F$ is a function of $\dot{q}$.
Almost everywhere I have seen it, Noether's theorem is said to be applicable when the Lagrangian changes by either a total time derivative in the discrete case, or by a four-divergence in the field case, of some function I will call $F$. My confusion holds in the discrete case, so I will use that since it is simpler. So we have, in most generality, if
\begin{equation}
L(t,q(t),\dot{q}(t)) \to L(t,q(t),\dot{q}(t)) + \frac{d F(t,q(t),\dot{q}(t))}{dt}
\end{equation}
under some continuous symmetry applied to $t$ and $q$, we say (although I suspect this may be sloppy) that the action and equations of motion are invariant under this continuous symmetry (and there is a conserved current, but that is outside this discussion).
It is clear why this implies the equations of motion remain unchanged under this symmetry if $F$ is not a function of $\dot{q}$ from the derivation of the Euler-Lagrange (EL) equations from the least action principle; since we fix the variation in $q$ to be zero at the endpoints, this function will always contribute nothing to the variation of the action.
I do not understand why this still holds if $F$ is a function of $\dot{q}$, since in the standard derivation of the EL equations we make no statement about the variation of $\dot{q}$ at the endpoints, and then a total derivative of a function of velocity can contribute to variations of the action:
\begin{equation}
\delta S = F(t,q(t),\dot{q}(t))|_{t_0}^{t_f} \ne 0,
\end{equation}
in general changing the equations of motion.
A good example of $F$ depending on $\dot{q}$ is the continuous symmetry of time translation, where $F \propto L$.
Possible solutions:


*

*Do we have to introduce boundary conditions so that $\dot{q}$ is not varied at the endpoints as well? This seems strange and unphysical, as we will be imposing double the regular boundary conditions (4 vs 2 for a free particle, for example; normally we fix only the two endpoints).

*Do we impose conditions on $F$ itself, so that $\delta S$ above is forced to be zero? This seems strange as well, especially given the example of $F \propto L$, as this in turn constrains $L$.

*Added in edit: Does "symmetry of the system" not necessarily mean that the equations of motion are left unchanged?

*Or does this mean that we do not necessarily treat this continuous symmetry as a symmetry of the equations of motion (so it is wrong to say that it in general leaves the action or equations of motion invariant), but only use Noether's theorem to find the conserved current (the current can be derived without assuming anything about the action)?
I suspect these are all slightly off-base, and thank you for your responses.
 A: OP is asking about (1) Euler-Lagrange (EL) equations and (2) Noether's (first) theorem.

*

*Let us start with EL eqs. OP is pondering what happens to EL eqs. if we change the Lagrangian $L$ with a total time derivative
$$\tag{1} \tilde{L}~:=~L+\frac{dF}{dt}$$
in various settings.
Often we assume that Lagrangians do not depend on
$\ddot{q},\dddot{q}, \ldots,$ in order to have 2nd order ODEs, cf. e.g. this Phys.SE post and links therein. This would mean that $F$ cannot depend on $\dot{q},\ddot{q},\dddot{q}, \ldots$.
However, OP is interested in the case where $F$ depends on $\dot{q}$, cf. e.g. this Phys.SE post. Then it would be natural to allow the Lagrangians to depend on $\ddot{q}$. This case is usually not encountered in Physics 101, but not unheard of. And OP correctly points out that this would mean that we might have to impose more boundary conditions (BC) in order to ensure that the stationary action principle is still well-posed.
The problem is that with inadequate BCs, the functional/variational derivative (FD) (which the EL eqs. are built from) may not exists, because infinitesimal variations of the action may contain non-vanishing boundary terms.
However, if the FDs exist for both Lagrangian $L$ and $\tilde{L}$ (by imposing appropriate BCs), then it should be stressed that eq. (1) automatically guarantees that the corresponding two EL eqs. are exactly the same, cf. e.g. my Phys.SE answer here.


*Now let's discuss Noether's (first) theorem. Let us assume that the original action $S=\int\! dt~ L$ yields a well-posed stationary action principle when pertinent BCs are imposed.
Next let us consider an (infinitesimal) transformation $\delta$. Note that $\delta$ is not required to respect the BCs of the variational problem. Let us assume that the transformation $\delta$ is a quasi-symmetry of the Lagrangian
$$\tag{2} dL~=~\varepsilon \frac{dF}{dt}+{\cal O}(\varepsilon^2) , $$
cf. e.g. my Phys.SE answer here.
Note that the transformation $\delta$ and the function $F$ could in principle depend on higher derivatives $q, \dot{q},\ddot{q},\dddot{q}, \ldots,$ as well as explicitly on time $t$.
We stress that eq. (2) is the defining property of a quasi-symmetry. It is the most important assumption that goes into Noether's theorem.
Then Noether's theorem states that the Noether charge $Q$ (as calculated via the Noether recipe) is conserved on-shell.
Example: Energy conservation. Assume that the Lagrangian $ L(q,\dot{q})$ does not depend explicitly on time $t$. Let the (infinitesimal) transformation be
$$\tag{3}\delta q~=~ \varepsilon \dot{q},$$
which does not obey Dirichlet BC. Then eq. (2) is satisfied with $F=L$, which depends on $\dot{q}$. So the transformation (3) is a quasi-symmetry of the Lagrangian. The corresponding Noether charge is the energy
$$\tag{4} h(q,\dot{q}) ~:=~ \dot{q}\frac{\partial L}{\partial\dot{q}}-L,$$
cf. this Phys.SE post.
A: It only is a symmetry when $F$ is independent of $\dot q$ (disregarding more complicated cases like Qmechanic mentions), exactly for the reason that you state: only then the equations of motion remain the same. Your possible solutions in order:

Do we have to introduce boundary conditions so that q˙ is not varied at the endpoints as well? This seems strange and unphysical, as we will be imposing double the regular boundary conditions (4 vs 2 for a free particle, for example; normally we fix only the two endpoints).

No, that is not what Hamilton's principle states.

Do we impose conditions on F itself, so that δS above is forced to be zero? This seems strange as well, especially given the example of F∝L, as this in turn constrains L.

Yes, we do, and it does constrain $L$, as it should. It constrains $L$ to be symmetric under time translation, which is not something that holds for all Lagrangians. 

Added in edit: Does "symmetry of the system" not necessarily mean that the equations of motion are left unchanged?

No, it does mean the equations of motion are left unchanged.
Could it be that the source of your confusion is that you are under the impression that for all Lagrangians time-translation is a symmetry? That is not the case in general, in particular it is not the case when energy is not conserved.
