Perhaps you've heard this piece of advice: never let a cold beer warm up and then become cold again. Practically, this means if you buy a refrigerated beer from the case, then you must keep it refrigerated until it's time to drink it. And it should never sit out at room temperature on the counter, in the pantry, etc. The threat is: the bizarre, off flavors of a beer that's been “skunked” usually described as tasting like wet newspaper, rubber, or if you ask me, the way the pet store smells.
Turns out… that's simply not true. At all.
In fact, it's not changes in temperature that make beer go bad, but exposure to ultraviolet light. In the sun or sat out in a grocery store display, the hops – those things that make beer taste like beer – will actually partially turn to sulfur, producing that characteristic rotten flavor.
A few years ago, Cook's Illustrated magazine put this to the test. They took a case of chilled beer, in cans to avoid any light exposure, and heated half of them to 85° for three hours before refrigerating again. They repeated the heating and cooling process three times, then tasted the cans side by side with the constantly-cool control. There was no difference whatsoever. (Also, fun day at the office!)
So, in fact, it's actually better to always buy beer from the cooler, where it's been kept under more consistent lighting conditions, and the refrigeration helps to preserve freshness and flavor.
In sum: buy it from the fridge, in cans or dark brown bottles to prevent UV rays, then store it in a cool dark place, either in your own refrigerator (which is both cool and dark), or a pantry. If you don't have any space, try a cooler or cardboard box or other dark enclosure. Kept at reasonable temps (no freezing or boiling) without light, it will be good to go for years. And in the case of some beer, particularly home brew and small production releases, it may taste even better.