IPAs go bad, barley wines improve, and stouts mellow over time. I'm curious though: what's actually happening? What compounds are building up or breaking down? What chemical processes actually happen to constitute "aging" in beer?
In short, the main factors in aging is a combination of compounds breaking down and oxidation.
IPAs - hop aroma breakdown
For IPAs, it's the hop aromas that break down fairly quickly - the aromatic compounds are volatile and break down noticably within a short timeframe:
Tom Nielsen, Sierra Nevada’s senior research analyst focused on hop degradation, says that their research has shown that after about two and a half to three months, hop aroma in a packaged beer, derived mainly from beta acids in the hop flower, has already started to diminish significantly. It’s a sentiment backed by Patrick Langlois at Great Divide in Denver, brewers of notable hoppy beers including their Fresh Hop Pale Ale, Titan IPA, and Hercules Double IPA. “Hops tend to dissipate in three to four months, which is why that is the recommended shelf life for most of our beers. (Source)
Barley Wines - Oxidation
Barley wines are not hop flavor or aroma focused beers - the major hop component is bittering acids, so they don't suffer the same problem with aroma losses as IPAs. However, some of the bittering compounds also have a half-life of 1 year, so clear changes are happening in that timeframe to the bitterness.
However, the major change for a barleywine is oxidation. There is always oxygen in the beer - either small amounts introduced during packaging, or from oxidization during the mash, which is then later released into the beer. When alcohol in the beer oxidizes, it becomes ethanal (acetaldehyde) which is a main component in sherry, and gives apple or sherry-like tones, which in a big barleywine are considered positive effects of aging, if kept in check.
Contrasting with both IPAs and barleywines, Stouts that are meant for aging are neither hop focused nor benefit much from oxidation. Oxidizing the medium roasted malts in the wort would produce cardboard flavors due to production of trans-2-nonenal. Fortunately, the highly kilned malts act as an anti-oxidant to help prevent the beer from oxidizing. What little odization does occur tends to produce port-like flavors.
The roasty character in stout comes from large Maillard compounds. These are still poorly understood, I can't find research to back it up, but I would guess the roasty character mellows due to the large compounds breaking down into shorter ones. This might explain why in some stouts the dark fruit flavors become more emphasized over time (since they are shorter Maillard compounds.)
Chemical reactions during a beer's aging are very complex, depending on a series of factors according to the beer's constitution and interaction between its components, as well as human perception of flavors. Certainly something way too complex to be briefly answered here.
I recommend you to read Patrick Dawson's Vintage Beer book. While it's not a extensive and deeply scientific study on the matter, I guess it's as best as you can get in a single literature nowadays.
Although some people have been aging beer for a long time, there isn't much formal knowledge about it yet, and most of what is known is from empiric experience and based on a lot of personal beliefs rather than strictly technical. But the book covers the basic.