I have read about one of Eisenstein's proof of quadratic reciprocity using a function of a complex variable, presented here (chapter 2.2, pp.11-15), which I summarized below. It's quite ingenious, and I cannot imagine how one may come up with such a proof. Can anyone explain that for me, or reveal some intuition behind the proof?
Consider the function $f(z) = e^{2\pi i z} - e^{-2\pi iz} = 2i \sin 2\pi z$. This function satisfies $f(z + 1) = f(z)$ and $f( -z) = -f(z)$. Also, its only real zeros are the half integers. In other words, if $r$ is a real number and $2r \notin \mathbb{Z}$, then $f(r) \neq 0$.
Lemma 1 (Gauss' Lemma). $(a/p) = (-1)^{\mu}$, where $\mu$ is the number of negative least residues of the integers $a, 2a, 3a, \dots, ((p-1)/2)a$.
Lemma 2. If $n > 0$ is odd, we have $$x^n - y^n = \prod_{k=0}^{n-1} (\zeta^kx - \zeta^{-k}y),$$ where $\zeta = e^{2\pi i/n}$.
Proof. We know the identity of polynomials $z^n-1 = \prod_{k=0}^{n-1}(z-\zeta^k)$. Let $z = x/y$ and multiply both sides by $y^n$. We get $x^n - y^n = \prod_{k=0}^{n-1} (x - \zeta^ky)$. Since $n$ is odd as $k$ runs over a complete system of residues $\mod n$, so does $-2k$. Thus $$\begin{align}x^n - y^n &= \prod_{k=0}^{n-1} (x - \zeta^{-2k}y) \\&= \zeta^{-(1+2+\dots+n-1)} \\&=\prod_{k=0}^{n-1} (\zeta^kx - \zeta^{-k}y)\end{align}$$
Lemma 3. If $n$ is a positive odd integer, then $$\frac{f(nz)}{f(z)} = \prod_{k=1}^{(n-1)/2}f(z+\frac{k}{n})f(z-\frac{k}{n}).$$
Proof. In the lemma, substitute $x = e^{2\pi iz}$ and $y = e^{- 2\pi iz}$. We see that $${f(nz)} = \prod_{k=0}^{n-1}f(z+\frac{k}{n}).$$ Thus $$\begin{align}\frac{f(nz)}{f(z)} &= \prod_{k=1}^{(n-1)/2}f(z+\frac{k}{n}) \prod_{k=(n+1)/2}^{n-1}f(z+\frac{k}{n}) \\&= \prod_{k=1}^{(n-1)/2}f(z+\frac{k}{n}) \prod_{k=(n+1)/2}^{n-1}f(z-\frac{n-k}{n}) \\ &=\prod_{k=1}^{(n-1)/2}f(z+\frac{k}{n})f(z-\frac{k}{n}). \end{align}$$
Lemma 4. If $p$ is an odd prime, $a\in\mathbb{Z}$, and $p\nmid a$, then $$\prod_{l=1}^{(n-1)/2}f(\frac{la}{p}) = (\frac{a}{p})\prod_{l=1}^{(n-1)/2}f(\frac{l}{p}).$$ Proof. Let $\pm m_l$ be the least residue of $la$, where $m_i$ is positive.Thus $la/p$ and $\pm m/p$ differ by an integer. This implies that $f(la/p) = f(±m/p) = ±f(m/p)$. The result now follows by taking the product of both sides as $l$ goes from $1$ to $(p - 1)/2$ and applying Gauss' lemma.
Theorem 5 (Law of Quadratic Reciprocity). Let $p$ and $q$ be odd primes. We have $$(\frac{p}{q})(\frac{q}{p}) = (-1)^{((p-1)/2)((q-1)/2)}.$$ Proof. By Lemma 4 $$\prod_{l=1}^{(p-1)/2}f(\frac{lq}{p}) = (\frac{q}{p})\prod_{l=1}^{(p-1)/2}f(\frac{l}{p}).$$ By Lemma 3 $$\frac{f(\frac{ql}{p})}{f(\frac{l}{p})} = \prod_{m=1}^{(q-1)/2}f(\frac{l}{p}+\frac{m}{q})f(\frac{l}{p}-\frac{m}{q}).$$ Putting these two equations together we have $$(\frac{q}{p}) = \prod_{m=1}^{(q-1)/2} \prod_{l=1}^{(p-1)/2}f(\frac{l}{p}+\frac{m}{q})f(\frac{l}{p}-\frac{m}{q}).$$ In the same way we find $$(\frac{p}{q}) = \prod_{m=1}^{(q-1)/2} \prod_{l=1}^{(p-1)/2}f(\frac{m}{q}+\frac{l}{p})f(\frac{m}{q}-\frac{l}{p}).$$ Since $f(\frac{m}{q}-\frac{l}{p}) = -f(\frac{l}{p}-\frac{m}{q})$ we see that $$(-1)^{((p-1)/2)((q-1)/2)}(\frac{q}{p}) = (\frac{p}{q})$$ and therefore that $$(\frac{p}{q})(\frac{q}{p}) = (-1)^{((p-1)/2)((q-1)/2)}.$$