Aged spirits are pretty magical when we consider that they're just a bunch of liquor thrown into wooden containers and left to sit for some particular length of time.
Before we begin, let me state for the record that when compared to guys who source the wood, make the barrels, and know exactly how long a spirit should be left to age, I'm a blithering idiot. There are people out there who make gonzo money by developing and maintaining a distiller's "oak program," and no shortage of recognized experts with wonderful accents. However, despite my meager frame of reference, I do know a few things that might help clarify how a number of wood-based variables eventually help to create what we know and love.
There are a lot of different names for what the layperson might call a “barrel” if they just happened to glance at whatever wooden storage container happens to hold booze. On the huge end are pipones, capable of holding ten thousand liters. On the small end are quarter casks, which hold only about 125 liters. Along the way are American Standard Barrels, pipes, hogsheads, rundlets, butts, and puncheons.
Why so many different sizes? In general, the greater the ratio is between the surface area and the volume of liquid in the cask, the more interaction the spirit has with the wood. A scotch like Laphroaig Quarter Cask comes out tasting perfectly top-notch after only 5 years of aging thanks to the relatively wee cask size. Other spirits might be thrown into a huge port pipe and left for the better part of two decades, aging gradually but very slowly.
2. Previous use.
By US law, bourbon barrels have to be made from virgin oak, which means nothing can be stored in them prior to the bourbon going in. Most cognac producers will also use new French oak barrels, at least for part of the spirit's maturation.
In the world of scotch, rum, and tequila, you're typically getting barrels that have come from somewhere and done something before being repurposed. According to the rules for making scotch whisky, you can't add wine directly into a barrel (that'd be cheating and adding flavor), but you can use an ex-sherry cask to give your whiskey a variety of new flavors, since enough sherry is stuck in the wood to marry with the spirit. Call it a hack.
"Finishing" a spirit is a pretty common practice not just among scotch, but across the major brown spirits in general: Teeling Small Batch Irish whiskey uses ex-rum barrels, the Japanese Hibiki 12 is finished in barrels that used to hold plum wine, and many tequilas source their barrels from bourbon distilleries. All of these flavors show up in the final product to varying degrees.
Insiders also also talk quite a bit about “first-fill” or “refill” casks. In the case of “first fill,” it means that as soon as the barrel has been emptied of bourbon, sherry, or whatever, it's sent to the distiller. You're going to maximize the amount of your finishing flavor, since a lot of it is still in the pores of the wood. However, if you use a refill cask, that means it was filled up with new make spirit, dumped out after it aged, and then filled back up again with another batch of spirit. If that cask was an ex-sherry cask, it's now going to have less sherry in it for the second batch. Think about what happens when you make a copy of a copy. The influence is still there, it's just diminished.
One shouldn't automatically assume, however, that a second-fill cask is in all cases inferior to a first-fill cask. Much to the contrary, a master blender might know that a refill cask can produce just enough sherry flavor at a target age of 15 or 18 years, allowing the flavors to come in subtly and naturally if that's the desired effect.
3. Wood type
Basically, your brown liquors are made with some kind of oak, no two ways about it. Others know a lot more than I do about why oak is used to the exclusion of almost all other woods, but I can give you the highlights. Oak is strong and watertight, doesn't leach strange flavors or chemical compounds into the spirit it stores, can actually filter out sulfuric compounds, and can improve the spirit by adding notes of vanilla and a smorgasbord of other flavors.
The two major varieties used are American oak and European oak. American oak as a general trend seems to give more vanilla and creamy notes, whereas French oak is a tad spicier and lends a more subdued and nuanced flavor profile. There are also a variety of exotic woods and other oak varieties, but I'd say that the overwhelming majority of aged spirits utilize either French, American or both types of oak together.
Where the barrel spends its time is another key factor in aging. Wood is porous and flexible, and it obeys the laws of thermodynamics: as temperature increases, it will expand, and as temperature cools, it will contract. As the pores open and close, outside air is drawn into and out of the cask and the spirit is drawn into and pushed out of the wood.
For that reason, aging happens a lot more rapidly in hot climates with lots of temperature variation like the US, and a lot more slowly in colder, more stable climates like Scotland. It's common to see age statements of 12 to 18 years on bottles of scotch, but leaving a bourbon in a barrel for that long will often produce something that's way too oak-heavy.
Age can be just a number when it comes to spirits, and using careful control of temperature, location, composition, and previous usage, distillers can produce a bewildering range of products—often in less time than one would expect! While nothing beats the experience of sipping a scotch that was patiently crafted for more than two decades, don't be too quick to dismiss younger spirits! There's a whole lot that's great out there and a whole lot of distillers who are choosing to work smarter, not longer.