Problems to understand closed string BCs in Polyakov action I apologize if this is an odd question. In the derivation of equations of motion in the Polyakov action
$$S_P = -\frac{T}{2}\int d^2\sigma \sqrt{-h} h^{ab}\partial_a X^\mu\partial_bX^\nu \eta_{\mu \nu}\tag1$$
where fields $X^\mu(\tau,\sigma)$ are scalar fields under worldsheet diffeomorphisms, we obtain the following boundary term [1]
$$-T\int_{-\infty}^{\infty} d\tau\left[ \sqrt{-h}\partial^\sigma X^\mu \delta X^\mu\right]^{l}_{0}. \tag2$$
One of the boundary conditions for closed strings are imposed by Polchinski as the $l$-periodicity of $X^\mu$
$$X^\mu(\tau, 0) = X^\mu(\tau,l).\tag3$$
However, I don't know how this implies that $\delta X^\mu(\tau,0) =\delta X^\mu(\tau,l)$ from the definition of variation (deformation) of a field given in Joshphysics  answer to this post. Following his notation, $$\delta X^\mu := \frac{\partial \hat{X}}{\partial \alpha}(0,\tau, \sigma)\tag4$$
where
$$\hat{X}^\mu (\alpha, \tau, \sigma) : \hat{X}^\mu (0, \tau, \sigma):=X^\mu (\tau, \sigma) \tag5$$
Of course, periodicity bof $X^\mu$ only implies periodicity of $\hat{X}^\mu$ for $\alpha=0$
How does this proceed?
EDIT: Even if I ignore $(4)$ as bolbteppa suggested, I have the same problem if I use$$\delta X^\mu(\tau,\sigma) = X^{\prime \mu}(\tau, \sigma) - X^\mu (\tau, \sigma)$$
It seems to me that I need to impose periodicity of $ X^{\prime \mu}$, which is not mentioned in he book.
The textbook I'm using is Polchinski's String Theory Vol.1 An Introduction to the Bosonic String Theory
 A: Polchinski [1] specifies in (1.2.30) that
$$X^{\mu}(0,\tau) = X^{\mu}(l,\tau)$$
$$X'^{\mu}(0,\tau) = X'^{\mu}(l,\tau)$$
$$\gamma_{ab}(0,\tau) = \gamma_{ab}(l,\tau)$$
are to be assumed. In words, the function $X^{\mu}(\tau,\sigma)$ is such that when it is evaluated at $\sigma = 0$ it must be the same function that it is at $\sigma = l$. Therefore if we vary the function $X^{\mu}(\tau,\sigma)$ by adding some fixed function to it in the function space, adding this same thing to $X^{\mu}(\tau,\sigma)$ at $\sigma = 0$ will have to give the same result that we got by adding that same thing to the $X^{\mu}(\tau,\sigma)$ at $\sigma = l$. In other words we can just apply $\delta$ to, i.e. take the variation of, the first equation above:
$$\delta X(0,\tau) = \delta X(l,\tau)$$
so that
$$[X' \cdot \delta X]^l_0 = X'(l,\tau) \cdot [\delta X(l,\tau) - \delta X(0,\tau)] = 0$$
since the thing in brackets is zero by our above reasoning. If you really want to push it, we can write the last thing in brackets as
$$\delta X(l,\tau) - \delta X(0,\tau) = \delta [X(l,\tau) - X(0,\tau)] = \delta [0] = 0.$$
Most books just assume the second and third relations are obvious consequences of the first, e.g. the second in words says if the function is the same at the endpoints, then it's derivative at those endpoints should be the same also, and so they just say the boundary conditions are automatically satisfied for a closed string without writing anything. Since the variation is contracted one can even assume [2] the boundary conditions
$$X^{\mu}(\tau,l) = M^{\mu}_{\nu} X^{\nu}(\tau,0)$$
for $M$ some constant invertible matrix so that
$$X'_{\mu}(\tau,l) \delta X^{\mu}(\tau,l) = X'_{\nu}(\tau,0) (M^{-1})^{\nu}_{\mu} M^{\mu}_{\rho} \delta X^{\rho}(\tau,0) = X'_{\nu}(\tau,0)  \delta X^{\nu}(\tau,0)$$
which ruins the interpretation of the $X^{\mu}$ as coordinates in space-time but in compactification etc... you can see it might become relevant.
References:

*

*Polchinski, "String Theory", Vol 1.

*Blumenhagen, Lust and Theissen, "Basic Concepts of String Theory", 1st Ed.

A: After Bolbteppa answer and Gold helpful comment and some reading on [1] I decided to write this answer. For simplicity, let $X^\mu(\tau, \sigma) := \gamma^\mu(\sigma)$ for fixed $\tau$ with $\sigma \in [0,l]$. Impose  that  $\gamma^\mu(0) =\gamma^\mu(l) = a^\mu $. We define an arbitrary deformation of $\gamma^\mu$ as a function  $F_\gamma ^\mu : [-\epsilon, +\epsilon] \times [0,l] \longrightarrow \mathbb{R}$, such that:
$$F_{\gamma} ^\mu(\alpha, \sigma) := \gamma^\mu _\alpha (\sigma) \ \text{for fixed $\alpha$} \tag1 $$
and
$$F_\gamma^\mu(\alpha, \sigma) := \xi^\mu _\sigma(\alpha)  \ \text{for fixed $\sigma$}\tag2$$
with the following conditions:
$$\gamma^\mu _0(\sigma) = \gamma^\mu(\sigma), \ \xi^\mu _0(\alpha) = \xi^\mu_l(\alpha).\tag3$$
The $"\xi"$ conditions are equivalent to $\gamma^\mu_\alpha (0) = \gamma^\mu_\alpha(l)$, i.e. all deformed curves are closed and have their meeting point for the same parameter values $\sigma=0, \sigma=l$, but not necessarily meet at the same point with coordinates $a^\mu$.
After all of this stuff, define the variation of $\gamma^\mu$ such that
$$\delta X^\mu (\tau,\sigma) = \delta \gamma^\mu(\sigma) := \frac{\text{d}\xi^\mu _\sigma}{\text{d}\alpha}(0). \tag4$$
Using second condition of $(3)$, we have that
$$\delta\gamma^\mu(0) = \frac{\text{d}\xi^\mu _0}{\text{d}\alpha}(0) = \frac{\text{d}\xi^\mu _l}{\text{d}\alpha}(0) = \delta \gamma^\mu(l)$$
At the end of the day, we will have that $\delta X^\mu (\tau,0) =\delta X^\mu (\tau,l)$, as desired.
Fixing $\sigma$ it is possible to expand the $\xi^\mu _\sigma(\alpha)$ with a Taylor expansion around $\alpha =0$ up to first order:
\begin{align}
\xi^\mu_\sigma(\alpha) &= \xi^\mu _\sigma(0) + \alpha \frac{\text{d}\xi^\mu _\sigma}{\text{d}\alpha}(0) + O(\alpha ^2)\\
&= \gamma^\mu(\sigma) + \alpha \delta \gamma^\mu(\sigma) + O(\alpha ^2)
\end{align}
just as the referred Joshphysics answer in my post,  wich is a bit different from most of the literature but still makes sense.
References:

*

*R. Aldrovandi, J.G. Pereira. An Introduction to Geometrical Physics ,2nd. ed.

