  For every $P \in \mathbb{Z}[x_1^{\pm 1}, \ldots, x_d^{\pm 1}] \setminus
\{0\}$, and every $\varepsilon > 0$, we prove that there are a computable
function $M = M(d,\varepsilon,\deg{P},h(P)) < \infty$ and a finite union $Z =
Z(d,\varepsilon,\deg{P},h(P))$ of proper torsion cosets $\boldsymbol{\mu} T
\subsetneq \mathbb{G}_m^d$ such that, for every $N \in \mathbb{N}$, $Z$
contains all but at most $M$ of the torsion points $\boldsymbol{\zeta} \in
\mu_N^d$ satisfying $|P(\boldsymbol{\zeta})| < e^{-\varepsilon \phi(N)}$. This
extends a well known structural theorem from torsion points lying exactly on a
variety to torsion points lying very near to the subvariety. As a consequence,
we prove that the averages of $\log{|P(\mathbf{x})|}$ over $\mu_N^d$ converge
as $N \to \infty$ to the Mahler measure of $P$.
  By the work of B. Kitchens, D. Lind, K. Schmidt and T. Ward, the convergence
consequence amounts to the following statement in dynamics: For every
Noetherian $\mathbb{Z}^d$-action $T : \mathbb{Z}^d \to \mathrm{Aut}(X)$ by
automorphisms of a compact abelian group $X$ having a finite topological
entropy $h(T)$, the exponential growth rate of the number of connected
components of the group $\mathrm{Per}_N(T)$ of $N \cdot \mathbb{Z}^d$-periodic
points of $(X,T)$ exists as $N \to \infty$, and equals the topological entropy
$h(T)$. Moreover, it follows that all weak-$*$ limit measures of the
push-forwards of the Haar measures on $\mathrm{Per}_N(T)$, under any a sequence
of positive integers $N$, are measures of maximum entropy $h(T)$.
  Our main arithmetic result extends to Diophantine approximation by points of
sufficiently small canonical height. It is best possible in such a generality,
where an exceptional set is an inevitable feature.
