Garlic likes soil with a lot of organic matter, and well drained. Garlic can tolerate wet soil for short periods of time, but will not grow in low areas, it tends to rot. If you have a low area that sometimes has standing water you must make raised beds.  Heavy clay soils are not tolerated well by garlic either.  They may grow but not well.  For a good harvest garlic must be happy.

 Garlic does best when the PH of the soil is 6.2 to 6.8 (slightly acidic.  Testing your soil PH is necessary for healthy garlic.  Garlic loves compost, especially composted manure.  Most composted manure is neutral or has a slightly acidic PH.  A soil test for NPK is also beneficial.  This will tell you if you need any soil amendments.  

Full sun is optimal, but no less than 8 hours a day.  Crop rotation helps with disease control.  Never plant garlic in a area where onions have grown.  Especially where onion sets or onion plants have grown.  Buying commercial onion sets or plants put you at risk of transferring an Allium disease to your garlic if planted in the same spot.  Yes, Onions and Garlic can transfer diseases back and forth.

If your in a climate with winter cold, fall is the best time to plant.  We try to time it, to plant 3-4 weeks before the ground freezes.  This gives the cloves time to sprout roots and secure themselves so the freezing ground will not heave them up.

When choosing a garlic type make sure it grows well in your climate.  Generally, Hardnecks grow better in an area that freezes in the winter, and Softnecks grow better in the warm south, but there are exceptions for each group.  I am in Northern Ohio, and I grow Inchillium Red which is a Softneck, and it grows well for me.  So do your research and also try tasting different types, then find your favorite.

Last of all, consider your patience level.  From planting time to harvest on most varieties is 10 months.  Albeit the wait is well worth it.  You can't get fresher garlic than pulling it out of your own garden.