BCS theory
Around 1957, Bardeen, Cooper, and Schrieffer developed an insightful model for how superconductivity can arise when the interaction between electrons in a metal has an attractive piece. A retarded phonon-mediated attraction between electrons, for example, can induce superconductivity, a qualitative change in the electrical conductivity and other properties. We now want to understand how that happens microscopically, using a variational approach and the second quantization formalism. Our starting point will be the interacting electron Hamiltonian
$$\begin{equation}
H = \sum_{{\bf k}\sigma} \epsilon_{\bf k} c^\dagger_{{\bf k} \sigma} c_{{\bf k} \sigma} + \sum_{{\bf k},{\bf k}^\prime,{\bf q}; \sigma,\sigma^\prime} V({\bf k},{\bf k}^\prime,{\bf q}) c^\dagger_{{\bf k}^\prime-{\bf q},\sigma^\prime} c_{{\bf k}^\prime,\sigma^\prime}
c^\dagger_{{\bf k}+{\bf q},\sigma} c_{{\bf k}; \sigma}
\end{equation}$$
As a simplifying approximation, we keep only one part of the full interaction term.
First introduce the pair creation and annihilation operators
$$\begin{equation}
b^\dagger_{\bf k} = c^\dagger_{k\uparrow} c^\dagger_{-k \downarrow},\quad
b_{\bf k} = c_{-k \downarrow} c_{k \uparrow}.
\end{equation}$$
Note that these are not quite bosons: they commute with each other at different $k$, as expected for bosons, but fail to have the correct commutation relation at the same $k$, where they behave more like fermions (one cannot create two pairs or annihilate two pairs at one value of $k$).
What we will keep is only the "pairing interaction" for zero total momentum pairs:
$$
H_{reduced} = \sum_{{\bf k}\sigma} \epsilon_{\bf k} c^\dagger_{{\bf k} \sigma} c_{{\bf k} \sigma} +
\sum_{{\bf k},{\bf k}^\prime} V_{{\bf k},{\bf k}^\prime} b^\dagger_{{\bf k}^\prime} b_{\bf k}.
$$
(Some justification is that this part of the interaction gives the leading instability of the Fermi liquid; taking into account the pairing interaction gives a new state, the superconducting state, that is stable to the neglected parts of the interaction.)
Now assume that the pairing interaction is always attractive. Then the ground state of $H_{red}$ turns out to have only empty or occupied pairs: i.e., for no value of ${\bf k}$ should there be exactly one total electron in the states ${\bf k},\uparrow$ and $-{\bf k},\downarrow$. Then
$$\begin{equation}
H_{red} = \sum_{{\bf k}\sigma} 2 \epsilon_{\bf k} b^\dagger_{\bf k} b_{\bf k} +
\sum_{{\bf k},{\bf k}^\prime} V_{{\bf k},{\bf k}^\prime} b^\dagger_{{\bf k}^\prime} b_{\bf k}.
\end{equation}$$
(The factor of 2 appears because there are two electrons per pair.)
Now we have a quadratic Hamiltonian in terms of the boson operators.
The main challenge in the variational technique is to select a sufficiently general class of variational wavefunctions that capture the physics of the new state. BCS had the idea to try wavefunctions of the form
$$\begin{equation}
|\psi_0\rangle = \prod_{\bf k} (1 + g_{\bf k} b^\dagger_{\bf k}) |0\rangle.
\end{equation}$$
The normalization of this state is
$$\begin{equation}
\langle \psi_0 | \psi_0 \rangle = \prod_{\bf k} (1 + |g_{\bf k}|^2)
\end{equation}$$
so henceforth let
$$\begin{equation}
|\psi_0\rangle = \prod_{\bf k} {1 + g_{\bf k} b^\dagger_{\bf k} \over (1 + |g_{\bf k}|^2)^{1/2}} |0\rangle.
\end{equation}$$
We want to constrain the total number of electrons to be some constant $N_0$, which
means looking for a stationary point (here $\mu$ is the chemical potential)
$$\begin{equation}
\delta W = \delta \langle \psi_0 | H_{red} - \mu N_0 | \psi_0 \rangle = 0.
\end{equation}$$
Then substituting the wavefunction gives, for the expectation value $W$,
$$\begin{equation}
W = \sum_{\bf k} 2(\epsilon_{\bf k} -\mu) {v_{\bf k}}^2 + \sum_{{\bf k},{\bf k}^\prime} V_{{\bf k},{\bf k}^\prime} u_{\bf k} v_{\bf k} u_{{\bf k}^\prime} v_{{\bf k}^\prime}
\end{equation}$$
Here we have introduced a shorthand (henceforth assuming spherical symmetry and
$g_k$ real)
$$\begin{equation}
u_k = {1 \over (1+{g_k}^2)^{1/2}},\quad v_k = {g_k \over (1+{g_k}^2)^{1/2}}.
\end{equation}$$
Note that ${u_k}^2 + {v_k}^2 = 1$.
Let us assume that there is a self-consistent solution of the famous "gap equation":
$$\begin{equation}
\Delta_k = - \sum_{k^\prime} V_{k k^\prime} {\Delta_{k^\prime} \over 2 E_{k^\prime}},
\end{equation}$$
where $E_k = \sqrt{(\epsilon_k - \mu)^2 + {\Delta_k}^2}$. This $E_k$ will turn out to be the energy required to create a "quasiparticle" at momentum $k$. We will choose
$$\begin{equation}
u_k v_k = {\Delta_k \over 2 E_k}.
\end{equation}$$
Now the variational equation (from varying $W$ with respect to the $g_k$) can be written simply: (note that variations of $u_k$ and of $v_k$ are not independent: $\delta u_k = - {u_k}^2 v_k \delta g_k$, $\delta v_k = {u_k}^3 \delta g_k$)
$$\begin{equation}
\delta W =
{u_k}^2 \delta g_k \left( 4 (\epsilon_k - \mu) {v_k} {u_k} +
2 (\sum_{k^\prime} {V_{k k^\prime} \Delta_{k^\prime} \over 2 E_{k^\prime}}) ({u_k}^2 - {v_k}^2)
\right) = 0.
\end{equation}$$
Then substituting in the gap equation gives
$$\begin{equation}
{u_k}^2 - {v_k}^2 = {\epsilon_k - \mu \over E_k},
\end{equation}$$
which combined with the constraint ${u_k}^2 + {v_k}^2 = 1$ gives
$$\begin{equation}
{u_k}^2 = \frac{1}{2}\left(1 + {\epsilon_k - \mu \over E_k}\right),\quad
{v_k}^2 = \frac{1}{2}\left(1 - {\epsilon_k - \mu \over E_k}\right).
\end{equation}$$
We can think of this wavefunction as describing a large number $N/2$ of "Cooper pairs", all in the zero-momentum and zero-spin state. However, note that there is still a hint of the fermionic nature of the underlying electrons, since we had to use all the electron states up to the Fermi level in order to make these Cooper pairs. The connection to the Ginzburg-Landau equation is, in words, that the LG equation describes the wavefunction of Cooper pairs, which in the absence of an external potential are all in the same center-of-mass state.
For now, we are going to make a simple step-function choice for the interaction $V$ that will give a so-called "s-wave" superconductor:
$$\begin{equation}
V_{{\bf k},{\bf k}^\prime} = -V < 0
\end{equation}$$
if both ${\bf k}$ and ${\bf k}^\prime$ are within some small distance $\delta k$ of the Fermi level, and 0 otherwise. We will see later how other potentials can give exotic superconductors of other symmetries.
Note that the fractional number variations in the BCS state are statistically very small ($\sim N^{1/2}$, where $N$ is the total number of electrons). We could choose a similar state of well-defined number, but would find that then the phase appearing in the Ginzburg-Landau equation is not well-defined: in this sense number and phase are conjugate variables in a superconductor.
It is amazing that the small attractive residual interaction, which only changes the electron interaction energy by a factor of about $10^{-8}$, can so dramatically change the physical properties.