The acidity of the soil has a huge effect on fertility because the acidity of soil controls how available nutrients are to your crops. This group of crops dislikes acid soil. Liming helps to maintain a balance between the soil's acidity and its alkalinity.
Clay soils tend to become acid more quickly than sandy soils and the amount of organic matter has an effect as well. Clay soils can also be slow to react to the addition of lime.
It is usually best to lime your soil in the autumn and allow it to work its way into the soil over the winter. You do not want to lime when you have crops in the ground as the lime may well damage the crops.
How much lime to use will depend on your soil type and how far you have to raise your pH by. To learn more about how to test your own soil, go to the 'garden conditions' link in your personal navigation bar to the right. There are articles there for you to read to learn how to test your soil.
Never mix lime and fertilizer or add them to soil at the same time. This will cause an unpleasant reaction.