This answer is best supported with a whiteboardAll living things need nitrogen, but nitrogen gas is too unreactive for plants and animals to use directly. Bacteria's main role in the nitrogen cycle is to be able to convert the nitrogen gas from the atmosphere into nitrates, so plants can use them. It's helpful to draw out a diagram of the cycle to keep track of all the steps. The main steps involved are decomposition, nitrification, nitrogen fixation and denitrification. In decomposition, bacteria in the soil breakdown the protein and urea in dead plants and animals into ammonium.In nitrogen fixation, there are two different types of bacteria. One type is in the soil and the other type can be found in the roots of some legume plants. These bacteria can directly 'fix' the nitrogen gas from the atmosphere and convert it into ammonium.In nitrification, nitrifying bacteria can convert this ammonium into nitrites and then into nitrates. These can then be used by plants from the soil.Finally, denitrifying bacteria convert nitrates in the soil back into nitrogen gas so we are back at the beginning of our cycle. This only happens when there are anaerobic conditions (when there is no oxygen).