Particle on $S^1$ and $U(1)$-principal bundle I have a question arisen from a simple QM problem: let consider a boson on $S^1$ minimally coupled with a constant gauge field $A$. Taking the stationary Schrödinger (S) or Klein-Gordon (KG) equation is possible to obtain:
$$
\mathcal{D}^2\psi = -\lambda^2\psi\tag{1}
$$
with $\mathcal{D}=(\partial + iA)$, $\lambda^2 = 2mE>0$ in the case of (S) and $\lambda^2=E^2-m^2>0$ in the case of (KG). Now, in order to solve this equation I have to put some conditions on $\psi$. Thinking $\psi$ as a section of an (associated) $U(1)$-bundle it is natural to write:
$$
\phi(2\pi)=e^{2i\pi\phi}\psi(0)\tag{2},
$$
where $2i\pi\phi$ is an arbitrary phase. Physically this means that phase is not observable, and so I can allow wave function to be not a proper function on $S^1$ (of course its modulus is). A general solution of $(1)$ with condition $(2)$ is simply
$$
\psi_n(x) = B_ne^{i(\lambda_n - A)x}+C_ne^{-i(\lambda_n + A)x}\tag{3}
$$
with 
$$
\lambda_n=\frac{n}{2}\tag{4}.
$$
(One can check that also $\psi'(x)$ is regular with this solution). The fact that is a bit surprising in $(4)$ is the presence of that half. Anyway, using $(3)$ it is simple to find:
$$
\psi(2\pi) =(-)^ne^{2i\pi A}\psi(0).
$$
If one thinks that in the case $A=0$ the $\psi$ is simply a function on $S^1$, one finds the condition that $n$ must be even, and so the apparent surprise of $(4)$ is thrown away.
Question: Basically I fed mathematics with $U(1)$ gauge group and, at the end, I found two class of solution: one periodic, one antiperiodic, so I found basically a $\mathbb{Z}_2$. What did I do from a geometric point of view? Why, given just $U(1)$, does this $\mathbb{Z}_2$ arise? 
 A: The solution that you wrote in your last (not numbered) equation is not a basis of a Hilbert space of sections because the phase factor: $(-1)^n e^{2i\pi A}$  depends on $n$. The phase factor should not depend on $n$. Please see your (correct) equation (2) defining the boundary conditions, in which the phase factor does not depend on $n$. 
Thus there is no solution with $\lambda = \frac{n}{2}$. The correct solutions must be with $\lambda = \pm n$, in this case, you may check that the phase factor is constant for all solutions.
Physically, this problem describes an Aharonov-Bohm particle moving outside a solenoid carrying a flux $2\pi A$. The Hilbert space you wrote in your last equation mixes solutions of two problems one with a positive flux and the second of a negative flux. The flux is the characteristic class of a flat principal U(1) bundle. Thus the solution mixes sections from different flat bundles (which consist of the same bundle but with a different flat connection given by a constant vector potential with vanishing magnetic field). Mathematically, these solutions belong to distinct superselection sectors and should not be mixed.
Apart from that, your definition of the associated line bundle to the U(1) principal bundle through the boundary conditions is correct.
Please, see the following lecture by Roberto Percacci, where the flat bundle geometry of the Aharonov-Bohm effect is explained in detail. 
