Plants in swampy areas suffer from being waterlogged and grow specialised roots up out of the water to gather oxygen, a bit like snorkels. In contrast, lilies grow contractile roots that actually pull the lily bulb down into the soil to keep it warm over winter. Just as plants have a distinctive shape above ground, so will their roots below. Plants may have a deep main root called a taproot, or many roots that spread out close to the surface. Large trees in the rain forest have got over the problem of thin soil found there by developing large buttress roots to help support the tree.
Plant roots have to grow to find the inorganic nutrients that the plant needs to stay alive.
However, the plant does not just grow and hope, it tastes the soil as it goes and if a patch of soil is particularly rich in nutrients it will concentrate on growing roots there. Some nutrients are particularly scarce in the soil and so certain plants have joined forces with bacteria and fungi to get hold of them. On the other hand, some bacteria can. So plants such as peas, clover, alder and bog myrtle have struck a deal with these bacteria. They provide a snug home for the bacteria in nodules on their roots and give the bacteria a supply of sugar, and in return the bacteria fix nitrogen gas from the atmosphere into a form that the plants can use.