This fact is important because nitrogen is usually the most limiting nutrient in plant nutrition throughout the world. Simply put, nitrogen-fixing plants convert nitrogen from a form plants cannot use into a form they can use. Plants do this with the help of "a bacterial partner", each entity giving something in return.
The plants are green, so can make their own sugars via photosynthesis (make food from the sun's energy). But the bacterium is not green, and cannot make its own sugars, for energy, as usually only green plants can photosynthesize. Fortunately, the bacterium can do some chemical magic, and change nitrogen found in the air into a simple nitrogen compound that the plant can use, such as nitrate. Simply, the plant gives the bacterium some sugars, (energy food to do their chemical magic ) and the bacterium gives the plant some nitrogen, and everyone is happy. A fair trade.
Some nitrogen-fixing plants do not form nodules on their roots, and they are considered by researchers to be more primitive, and fix lesser amounts of nitrogen.
The way that other plants benefit is that when leaves from the nitrogen-fixing plant fall off onto the ground, then other bacteria, that live in the soil, convert those leaves, into humus. During this process, the nitrogen in the leaves (mostly in the form of proteins) is changed back into nitrate in the soil, which nearby plants can pick up and use. Also, some of the annual nitrogen-fixing plants die after one year, and soil bacteria also convert those dead plants into humus, and more nitrogen is produced for nearby plants.
This is why it is always better to set out plants in groups, with some nitrogen-fixing plants included, so all the neighboring plants can benefit from the nitrogen-fixing plants.