  We are concerned with an harmonic analysis in Hilbert spaces $L^2(\mu)$,
where $\mu$ is a probability measure on $\br^n$. The unifying question is the
presence of families of orthogonal (complex) exponentials $e_\lambda(x) =
\exp(2\pi i \lambda x)$ in $L^2(\mu)$. This question in turn is connected to
the existence of a natural embedding of $L^2(\mu)$ into an $L^2$-space of Bohr
almost periodic functions on $\br^n$. In particular we explore when $L^2(\mu)$
contains an orthogonal basis of $e_\lambda$ functions, for $\lambda$ in a
suitable discrete subset in $\br^n$; i.e, when the measure $\mu$ is spectral.
We give a new characterization of finite spectral sets in terms of the
existence of a group of local translation. We also consider measures $\mu$ that
arise as fixed points (in the sense of Hutchinson) of iterated function systems
(IFSs), and we specialize to the case when the function system in the IFS
consists of affine and contractive mappings in $\br^n$. We show in this case
that if $\mu$ is then assumed spectral then its partitions induced by the IFS
at hand have zero overlap measured in $\mu$. This solves part of the \L
aba-Wang conjecture. As an application of the new non-overlap result, we solve
the spectral-pair problem for Bernoulli convolutions advancing in this way a
theorem of Ka-Sing Lau. In addition we present a new perspective on spectral
measures and orthogonal Fourier exponentials via the Bohr compactification.
