When you're at the farmers' market, avoid any bulbs that appear soft or damaged, or are sprouting (if it was a wet spring and summer, the cloves may start to grow right away and split the bulb apart even before harvest). Look for undamaged cloves for long-term storage.
The easiest way to store garlic at home is in mesh bags or loosely woven baskets. Garlic with flexible tops can be made into pretty braids to hang. But garlic with a stiff central stalk—often called hardneck garlic—will shatter if you try to braid it.
Garlic keeps longest when stored at 60 to 65 degrees and in moderate humidity. This is what makes storing fresh garlic throughout the winter so hard: Heated winter homes tend to be very, very dry—so dry that garlic cloves will shrivel up and turn rock-like inside their papery skins after just a month or two (if that ever happens to yours, just toss 'em, skins and all, into your next batch of vegetable stock). One trick is to store garlic under an unglazed clay flowerpot in a cupboard, creating a small humidor without completely cutting off air circulation, which can lead to rot problems.
Lacking storage space for an upside-down flower pot? There are a few other easy ways to store garlic that won't undermine its flavor.
Related: Onion + Garlic Braids Too Beautiful To Hide In The Pantry