As bacteria are involved in the production of ethanol through fermentation and ethanol is also used as antiseptic that kills bacteria, so how and why bacteria are involved in the synthesis of such alcohol which is lethal for itself(bacteria)?
Yeast can produce up to 16-17 v/v% ethanol without dying according to this article. Yeast is a primary industrial ethanol producer, it produces ethanol even under aerobic conditions, in contrast to bacteria that usually ferment sugar to ethanol under anaerobic conditions. Bacteria can also withstand up to several percent v/v concentration ethanol in their media. Check this paper for details. They produce ethanol because it is a natural byproduct of their cellular metabolism. Under anaerobic conditions sugar as the primary energy source cannot be oxidized and utilized as well as in aerobic conditions.
Alcoholic fermentation converts one mole of sucrose into two moles of ethanol and two moles of carbon dioxide, producing two moles of ATP in the process.
Anaerobic bacteria follow this path because fermentation of ethanol does not require oxygen. This byproduct is secreted from the cells. In natural environments ethanol either dilutes in the media bacteria live in or can be taken up by acetic acid bacteria and used as an energy source.