What does the Haar measure on $\hat{\mathbf{Z}}$ look like? What does the Haar measure on $\hat{\mathbf{Z}} = \prod_p \mathbf{Z}_p$ look like?
Does it bear any relation to the "upper density" of a subset $S\subset\mathbf{N}$ defined by $m(S) = \limsup_{n\to\infty} |S\cap\{1,\ldots,n\}|/n$?
 A: Since $\widehat{Z}$ and $\mathbb{Z}_p$ are compact, we will assume unit volume. This is standard, but you can change at the Haar measure at any set of finite places.
As you will know any the topology on $\widehat{Z}$ is that of an infinite product of space (se Tychonoffs theorem), in particular any open set looks like
$$O = O_{p_1} \times O_{p_2} \times .... \times O_{p_k} \times \prod\limits_{p \neq p_j} \mathbb{Z}_p$$
and the measure of $O$ is precisely
$$ \mu(O) = \mu_{p_1}(O_{p_1}) \cdots \mu_{p_k}(O_{p_k}).$$
Now for any open set $O$ the set $O \cap \mathbb{Z}$ has finite index in $\mathbb{Z}$, i.e. an ideal, so the upper density will be $index^{-1}$, so here there are actually equal. 

For any open set $X \subset \widehat{Z}$, the measure $\mu(X)$ is precisely the upper density of $S =X \cap \mathbb{Z}$ in the standard parametrization.

For measurable set is does not work, since the upper density is obviously not a measure.
I am not too familiar with the upper density, so I cannot go the other way;(
A: A way to construct an Haar measure on $\hat{\Bbb Z}$ is to take the product $\prod dz_p$ where $dz_p$ is an Haar measure on $\Bbb Z_p$ normalized so that $\int_{\Bbb Z_p}\,dz_p=1$.
This measure actually extends to an Haar measure on the full ring of adeles $\Bbb A=\Bbb Q\Bbb R\hat{\Bbb Z}$.
Any other Haar measure on $\hat{\Bbb Z}$ (or $\Bbb A$) is a scalar multiple of this one.
