  We study optimal conditions for violation of the Clauser-Horne-Shimony-Holt
form of the Bell inequality in the presence of decoherence and measurement
errors. We obtain all detector configurations providing the maximal Bell
inequality violation for a general (pure or mixed) state. We consider local
decoherence which includes energy relaxation at the zero temperature and
arbitrary dephasing. Conditions for the maximal Bell-inequality violation in
the presence of decoherence are analyzed both analytically and numerically for
the general case and for a number of important special cases. Combined effects
of measurement errors and decoherence are also discussed.
