  We develop topological dynamics for the group of automorphisms of a monster
model of any given theory. In particular, we find strong relationships between
objects from topological dynamics (such as the generalized Bohr
compactification introduced by Glasner) and various Galois groups of the theory
in question, obtaining essentially new information about them, e.g. we present
the closure of the identity in the Lascar Galois group of the theory as the
quotient of a compact, Hausdorff group by a dense subgroup.
  We apply this to describe the complexity of bounded, invariant equivalence
relations, obtaining comprehensive results, subsuming and extending the
existing results and answering some open questions from earlier papers. We show
that, in a countable theory, any such relation restricted to the set of
realizations of a complete type over $\emptyset$ is type-definable if and only
if it is smooth. Then we show a counterpart of this result for theories in an
arbitrary (not necessarily countable) language, obtaining also new information
involving relative definability of the relation in question. As a final
conclusion we get the following trichotomy. Let $\mathfrak{C}$ be a monster
model of a countable theory, $p \in S(\emptyset)$, and $E$ be a bounded,
(invariant) Borel (or, more generally, analytic) equivalence relation on
$p(\mathfrak{C})$. Then, exactly one of the following holds:
  (1) $E$ is relatively definable (on $p(\mathfrak{C})$), smooth, and has
finitely many classes,
  (2) $E$ is not relatively definable, but it is type-definable, smooth, and
has $2^{\aleph_0}$ classes,
  (3) $E$ is not type definable and not smooth, and has $2^{\aleph_0}$ classes.
  All the results which we obtain for bounded, invariant equivalence relations
carry over to the case of bounded index, invariant subgroups of definable
groups.
