  (abridged) We investigate in detail the role of active galactic nuclei on the
physical state of the gas in galaxy groups and clusters, and the implications
for anisotropy in the CMB from Sunyaev-Zeldovich effect. We include the effect
of thermal conduction, and find that the resulting profiles of temperature and
entropy are consistent with observations. Unlike previously proposed models,
our model predicts that isentropic cores are not an inevitable consequence of
preheating. The model also reproduces the observational trend for the density
profiles to flatten in lower mass systems. We deduce the energy E_agn required
to explain the entropy observations as a function of mass of groups and
clusters M_cl and show that E_agn is proportional to M_cl^alpha with alpha~1.5.
We demonstrate that the entropy measurements, in conjunction with our model,
can be translated into constraints on the cluster--black hole mass relation.
The inferred relation is nonlinear and has the form M_bh\propto M_cl^alpha.
This scaling is an analog and extension of a similar relation between the black
hole mass and the galactic halo mass that holds on smaller scales. We show that
the central decrement of the CMB temperature is reduced due to the enhanced
entropy of the ICM, and that the decrement predicted from the plausible range
of energy input from the AGN is consistent with available data of SZ decrement.
We show that AGN heating, combined with the observational constraints on
entropy, leads to suppression of higher multipole moments in the angular power
spectrum and we find that this effect is stronger than previously thought.
