Let's choose $m \in \mathbb{N}^*$ and let $\chi$ be a character modulo $m$. We define the corresponding $L$-function by the formula
\begin{equation*}
L(s,\chi) = \sum\limits_{n=1}^{+ \infty} \frac{\chi (n)}{n^s}
\end{equation*}
for $s \in \mathbb{C}$, and also the zeta function
\begin{equation*}
\zeta_m (s) = \prod\limits_{\chi \in \widehat{(\mathbb{Z}/m \mathbb{Z})^*}} L(s , \chi )
\end{equation*}
One can prove that $\zeta_m$ has a simple pole at $s=1$.

Density of a subset of prime numbers

A fairly precise information about the density of prime numbers among all integers is given by the following estimation, when $s$ tends to 1 :
\begin{equation*}
\sum\limits_{p \in \mathbb{P}} \frac{1}{p^s} \sim \log \frac{1}{s-1}
\end{equation*}
to be compared with
\begin{equation*}
\sum\limits_{n \in \mathbb{N}^*} \frac{1}{n^s} \sim \frac{1}{s-1}
\end{equation*}
The simple fact that the two series diverge for $s=1$ and converge for $s>1$ is striking ! In fact, taking the logarithm of the second relation gives the first one :
\begin{equation*}
\log \sum\limits_{n \in \mathbb{N}^*} \frac{1}{n^s} = \log \prod\limits_{p \in \mathbb{P}} \frac{1}{1-\frac{1}{p^s}} = \sum\limits_{p \in \mathbb{P}} \sum\limits_{k \in \mathbb{N}^*} \frac{1}{k \times p^{ks}} = \sum\limits_{p \in \mathbb{P}} \frac{1}{p^s} + \psi(s)
\end{equation*}
where it is easy to see that $\psi(s)$ remains bounded when $s \rightarrow 1$ (show this !).

Now if we take any subset $A$ of the set of prime numbers, we can define its density as
\begin{equation*}
d(A) = \lim\limits_{s \rightarrow 1} \frac{\sum\limits_{p \in A} \frac{1}{p^s} }{\log \frac{1}{s-1}}.
\end{equation*}
With this at hand we can state the theorem: let $m \in \mathbb{N}^*$ and $a \in \mathbb{Z}$ such that $m$ and $a$ are relatively prime ; then the set $P_{m,a}$ of primes $p$ such that $p \equiv a$ mod $m$ has density $\frac{1}{\phi(m)}$. This is truly fantastic : the first thing to notice is that $P_{m,a}$ is infinite, and more than that, its density doesn't depend on $a$, meaning that the primes are equally distributed between the different classes modulo $m$, and this is true for any $m$.

How can we see that the theorem above is true ? What we want to study is
\begin{equation*}
\sum\limits_{p \in P_{m,a}} \frac{1}{p^s}
\end{equation*}
We would like to use the machinery of $L$-functions and characters. Thus the trick is to translate the condition $p \equiv a$ mod $m$ using the characters. In $(\mathbb{Z}/m \mathbb{Z})^*$, this condition reads $a^{-1} p=1$. But the number 1 has a very neat characterization with the characters : if $p \equiv a$ mod $m$,
\begin{equation*}
\sum\limits_{\chi} \chi (a^{-1} p) = \phi (m)
\end{equation*}
and else the sum vanishes. Thus
\begin{equation*}
\sum\limits_{p \in P_{m,a}} \frac{1}{p^s} = \sum\limits_{p \nmid m} \frac{1}{\phi (m)} \sum\limits_{\chi} \chi (a^{-1} p) \frac{1}{p^s} = \frac{1}{\phi (m)} \sum\limits_{\chi} \chi (a^{-1}) \left[ \sum\limits_{p \nmid m} \frac{\chi(p)}{p^s} \right]
\end{equation*}
The square bracket gives the wanted $\log \frac{1}{s-1}$ for $\chi=1$, and what remains to be shown is that for $\chi \neq 1$, it is bounded. It is slightly more technical, but can be done using similar arguments.

Other notions of density

The density defined above was the analytic density, it measures roughly "how the sum of the inverses diverge". This is a useful tool to estimate the "size" of a set of integers : for $\mathbb{N}^*$, the divergence is $\frac{1}{s-1}$, for primes, it is $ \log \frac{1}{s-1}$ and for primes in $P_{m,a}$ it is $\frac{1}{\phi (m)} \log \frac{1}{s-1}$.

An other idea to compare the sizes of sets of integer is to truncate them at some fixed value, say $N$, and to compare their finite cardinal. If we let $N$ go to infinity, the ratio of the two cardinals may tend to a limit, which we call the natural density. One can prove that, if $A$ has natural density $k$, then the analytic density of $A$ exists and is equal to $k$. The converse does not hold in general.