Like wine, most beer is produced with the expectation it will be drunk right away. People talk about aged wine, but it's special bottles, only, that can hold up beyond 1 or 2 years in storage. With wine, aging when you're not supposed to results in "flat" or less flavor-ful wine: it loses it's "spark" in the same way an expired can of soda does.
In the vernacular of beer, there is even a word for beer that has been too long in the bottle, and who's flavor has changed for the worse because of it: skunky. So, don't try this at home: most beers won't benefit from the aging process!
But like wine, a beer crafted for the express purpose of aging, full of big, bold flavors and high alcohol content can be kept for an extended period of time, and cellaring can often improve the flavor, creating to a smoother, balanced beer. And, like wine, an age-able beer needs to be stored in a cool, dark place to allow it to age without negative effects from too much light or temperature changes.
Specially crafted beers can be found at the more diverse beer distributors and specialty shops. Online communities exist to help figure out which beers will hold up to aging, share general knowledge, and trade bottles to experiment with or experience the results. Your local grocery store brands are probably not up to the aging process... our hope is to show that there are brewers out there who are having fun creating something more complex that you can hold on to--for a while.
To age or not to age? Ask when you purchase your wine or beer if you're not sure but want something you can keep for the long run.