Hamilton's principle when the limits $t_1$ and $t_2$ of the path are not fixed Hamilton's principle states that the path taken by the system between times $t_1$ and $t_2$ and the coordinates $q_1$ and $q_2$ is the one for which the variation of the action functional is zero:
$$
\delta S= \delta \int_{t_{1}}^{t_{2}} L\left(q_{j}, \dot{q}_{j}, t\right) d t=0, \tag{1}
$$
If we assume that the limits of the integral are fixed, we can pass the $\delta$ operator inside the integral by Leibniz's rule, obtaining the classical result
$$\delta \int_{t_{1}}^{t_{2}} L\left(q_{j}, \dot{q}_{j}, t\right) dt =\int_{t_{1}}^{t_{2}} \delta L\left(q_{j}, \dot{q}_{j}, t\right) dt, \tag{2}$$
$$
\int_{t_{1}}^{t_{2}}\left(\frac{\partial L}{\partial q_{j}}-\frac{d}{d t} \frac{\partial L}{\partial \dot{q}_{j}}\right) \delta q_{j} d t=0.
$$
However, according to a footnote on p. 208 in Marion and Thornton's Classical Mechanics book,

It is not necessary that the limits of integration be considered fixed. If they are allowed to vary, the problem increases to finding not only $q(t)$ but also $t_{1}$ and $t_{2}$ such that $S$ is an extremum.

What form would then take Hamilton's principle in this case where the limits of integration are not fixed? That is, how would the $\delta$ operator act on an integral of this kind?
Note. I have found in another source that the variation of the action would take this form, but not a justification for it:
$$\delta S=\int_{t_{1}}^{t_{2}}\left(\frac{\partial L}{\partial q_j}-\frac{d}{d t}\left(\frac{\partial L}{\partial \dot{q_j}}\right)\right) \delta q_j d t+\left.(p_j \delta q_j-H \delta t)\right|_{t_{1}} ^{t_{2}}. \tag{3}$$
 A: In the derivation of the Euler-Lagrange equation you typically use integration by parts, which gives something like
\begin{align*}
\delta S &= \sum_k \frac{\partial L}{\partial \dot{q}_k}\delta q_k \Bigg|_{t_1}^{t_2} + \int_{t_1}^{t_2} \sum_k \left(\frac{\partial L}{\partial q_k} - \frac{\mathrm{d}}{\mathrm{d}t}\frac{\partial L}{\partial \dot{q}_k} \right) \delta q_k \, \mathrm{d}t
\end{align*}
Assuming the variation vanishes at $t_1, t_2$ i.e. $\delta q_k(t_1) = 0 = \delta q_k(t_2)$ and assuming you can vary them independently you get the usual EL equations. But if you don't fix the endpoints the first sum will be nonzero and you have more conditions that you need to fulfill. If they aren't fixed you will need to solve the EL equations and
$$
\frac{\partial L}{\partial \dot{q}_k}\Bigg|_{t_1, t_2} = 0
$$
to ensure that $\delta S = 0$. Note that in the Hamilton formalism this will be the generalised momentum that appears in your equation. If $\partial_t L \neq 0$ then the energy $H$ won't be conserved so it'll contribute to the variation at the endpoints aswell.
A: *

*In the stationary action principle/Hamilton's principle the endpoints $t_i$ and $t_f$ are kept fixed, and one needs to impose essential or natural boundary conditions (BCs).


*If the endpoints $t_i$ and $t_f$ are free to be varied (but still assuming essential or natural BCs for the dynamical variable $q$), then in order to have a well-defined variational problem, one typically have to fix something else.


*Example: In Maupertuis' principle for the abbreviated action, the energy is fixed instead.


*Here is a related Phys.SE post.
A: I just wrote the answer below.
But after submitting it it occurred to me that possibly what was being referred to was some procedure of varying spatial coordinate and time interval simultaneously. Such simultaneous variation is not considered in the answer below; it hadn't occurred to me. (Nor does it make sense to me.)


To address this question let's first look at what happens in the case of a particular simple example: a uniform force,
An object is released with an initial velocity, a uniform gravitational force is acting downward. As we know, the resulting motion is along a parabola.
The thing is: the overall shape of the resulting motion is determined exclusively by the rate of acceleration. That overall shape is a parabola
The choice of start time and end time gives motion along a particular subsection of the entire parabola, but it's always a subsection of the same parabola. Again: the shape of that parabola is determined exclusively by the rate of acceleration.
Let's say we use a coordinate system with x-axis and y-axis, and we draw the parabola symmetric with respect to the vertical axis.
-We can choose to traverse the parabola from $t=-1$ to $t=1$
-We can choose to traverse the parabola from $t=-2$ to $t=2$
In both cases a subsection of the parabola is traversed. Longer duration of the time interval: longer subsection. But it's the same parabola.
The takeaway is that the choice of start time and end time makes no difference. Solving the equation finds the parabola.


Next we look at what will happen in the case of Hooke's law. As we know: when the force is according to Hooke's law the resulting motion is harmonic oscillation. As we know, the name of the mathematical function that describes harmonic oscillation is 'the sine function'.
We get the same thing: the choice of start point and end point determines the subsection of the sine function that the motion will be along, but the shape of the function that describes the motion (sine) is determined exclusively by the character of the potential.
Clearly this property generalizes to any potential.


The statement that you quote:

It is not necessary that the limits of integration be considered fixed.

Is an empty statement.
Of course that's not necessary!
The whole point is that you never actually use numerical values for the start time and end time.
Throughout the mathematical manipulations you just keep using the symbols $t_1$ and $t_2$. That is: you never actually specify the time interval numerically.
You defer specifying the time interval because your goal is the general solution. The general solution is the overall shape of the motion: along a parabola in the case of a linear potential, and along a sine function in the case of Hooke's law.
Once you have obtained that general solution you have obtained the information you need.
In some instances you actually need to calculate a trajectory from a specific start point to a specific end point. It's only then that you start using numerical values for start time and end time.


 
Hamilton's stationary action is applicable when the force that is involved has the property that the difference in potential between point A and point B is independent of the path that an object takes between A and B; the force must be a *conservative force*. 
The property of being a conservative force includes the implication that the acceleration caused by the force is independent from the current velocity of the object.
Under those circumstances solving for the equation of motion gives a general solution. Being a general solution it has the generality to accommodate any combination of initial conditions; any initial position, any initial velocity.
See also:
A discussion of Hamilton's stationary action that I submitted in May 2021
