With the eager step of a man who's just turned 40 and found his purpose in life, Paul Walker strides in his wellies across the flagstones of the 14th-century Union Inn in Denbury, south Devon, and orders two pints of Denbury Dreamer.

We sip carefully, appreciatively. It's a fine beer: smooth malt flavours, a lovely light floral hop finish, not a hint of bitterness. A treat. Paul closes his eyes, nods, allows himself a brief smile of intense satisfaction. "I made that," he says.

He probably deserves his moment of contentment. He's been up since before six, won't finish till seven, and will almost certainly have to nip back at least once during the evening. It's hard work, being a microbrewer, and there was a time two summers ago, a few months after he'd started, when he really thought the whole thing was about to go under.

But this summer Hunter's Brewery, just up the road from Denbury in Ipplepen, is selling between 60 and 100 nine-gallon barrels of real ale every week to 200-plus pubs across the south-west. Capacity is set to increase sixfold within months. Paul and his wife Eline haven't yet drawn a salary from it. But the day's not far off.

Hunter's is part of a remarkable early 21st-century flowering of traditional British ale. Helped by an increasingly enthusiastic public and a handy excise duty relief that effectively halves your tax bill as long as you make no more than about 3,000 barrels a year (thank you, Gordon Brown), some 50 new small breweries are expected to open around the country this year.

There are now, in fact, more breweries in Britain than at any time since the end of the second world war: well over 800, against half that number, of all sizes, less than a decade ago, and a mere 140 in 1970. And we clearly like what they're brewing: sales of "live", cask-conditioned ales, which ferment a second time in the barrel, have surged by 25% over the past five years.

What makes this more striking is that overall, our national drink is in seemingly irreversible decline. The UK beer market, still dominated by the big keg lagers such as Carling and Foster's – which, for the sake of shelf life, get filtered or pasteurised after brewing to kill off the yeast, then are injected with CO 2 in an effort to give them back some semblance of life – shrank by 7% last year. And we're losing 25 pubs a week.

Real ale, though, is undergoing a spirited revival. One clue as to why comes in the slogan emblazoned on a T-shirt sported by a cheery, bearded and large-bellied man at the Great British Beer Festival at the Earls Court exhibition centre this month. "What's the matter, Lagerboy," it demanded, "afraid you might taste something?"

Real ale, says Mike Benner, CEO of Camra, the Campaign for Real Ale (whose T-shirt, by the way, that wasn't), has flavour. "The technology's improved massively, and there's been a huge leap in quality," he says. "And real ale is obviously part of a whole broader trend in food and drink for authenticity, tradition, localism, provenance. But, ultimately, it's about the sheer variety of styles, and the richness of the flavours."

Brewers these days are experimenting with new styles and reviving old ones, long forgotten: smooth, highly hopped best and premium bitters; potent pale ales and India pale ales; dark, sweet, chocolatey porters, an 18th-century favourite; rounder, softer milds, which died a dismal death in the 60s but are now bouncing back; heavy, grainy, creamy stouts; fruity, refreshing, pale amber golden ales, a newcomer designed to tempt the dreaded Lagerboy.

The small scale of the new breed of brewery gives flexibility, so they can produce short runs of seasonal or special occasion and bespoke ales (Hunter's brews its Denbury Dreamer, for example, solely for the Union Inn). And many of them are now available in bottles, where they'll continue to gently ferment until you crack them open at home.

"The common perception of real ale used to be that it was just bitter – what grandad drank, the preserve of men in thick woolly jumpers," says Brenner. "It's just not true any more. There are flavours of every kind, for every palate, and people are really getting it: 40% more are trying ale than were five years ago. When you think, only 10 years ago people were saying this would never be more than a niche product. This is a real renaissance."

Against all the odds, real ale is a happening industry. A convention-challenging new generation of brewer typified by the likes of 20-somethings Martin Dickie and Jamie Watt of the phenomenally successful BrewDog in Aberdeenshire, sport shaved heads and porkpie hats and raise finance by flogging shares to Joe Public in operations they call Equity for Punks. According to Camra, 17% more 18-to 24-year-olds drank real ale last year than in 2010.

Downstairs at Earls Court, queuing at bars for beers with names such as Elsie Mo, Alley Cat, Black Adder, Chopper Fuel; Hedgemonkey, Full Whack, Mad Monk and Praetorian Porter, the crowd seems to back this up. "Beer's every bit as rewarding and complex as wine, but no one's dared say it until now," says Jeanette James, 26, a marketing executive from Putney, south-west London. "There are really delicate, elegant flavours out there now. I don't drink a lot of it, but I really, really appreciate what I do."

Alex Lester, 23, from Solihull, and a serious connoisseur, was filling in notes on a tasting card. "You should call them craft ales, not real ales," he says. "That's the level they've reached. The characters are all so distinct. Some you'd drink right through a serious session, some you'd savour by the glass, like with a particular kind of meal. Ale's pretty cool."

The big retailers have certainly got it: Sainsbury's is organising a Great British Beer Hunt that will see 16 new British ales, selected in regional heats, battle it out from early September for a permanent place on the shelves in some 300 stores. "We're seeing 7% year-on-year growth in premium bottled beers," says Oliver Chadwick-Healey, its beer buyer. "This is a real phenomenon, driven by choice and quality."

The world's number three drink (after water and tea) has come on quite a journey since 3400BC, which is when the earliest barley beer to have been chemically confirmed was brewed, in the Zagros mountains of Iraq. By the late Middle Ages beer was being brewed all over northern Europe, including in monasteries whose monks should probably have known better.

In England, it's thought, we once drank around 65 gallons of it each a year, with every meal; having been boiled, it was a fair bit safer than plain water. (Wine-soaked southern Europeans never really understood. Regardless of whether it was made from oats, barley or wheat, beer "harms the head and the stomach, causes bad breath and ruins the teeth, and fills the stomach with bad fumes," wrote the 13th-century Italian medic Aldobrandino of Siena. "But it does have the property of facilitating urination and makes one's flesh white and smooth.")

Whatever its properties, beer is indisputably Britain's national drink. Its character has changed over the years. Hopped beer – hops add the more savoury, floral notes to the caramel and toffee tones of the toasted barley of the malt – was imported from the Netherlands from around 1400. Thermometers and hydrometers were improving quality and consistency by the 1700s, when London breweries bearing names such as Whitbread and Truman were between them selling a staggering million barrels of porter a year.

The 19th century saw the development in Burton-on-Trent of a revolutionary light, well-hopped beer – pale ale, from which bitter was eventually born – that proved spectacularly popular with the Victorians: at one stage, a quarter of all the ale produced in Britain was brewed in Burton, largely because its water, rich in gypsum, imparted a particular, much appreciated quality. (Burton's pre-eminence only ended only when someone worked out how to replicate the chemical composition of the water, a process still known as Burtonisation).

By the time the second world war was over, though, beer was in a pretty sorry state. "The quality was awful," says Fergus McMullen, whose family have been brewing beer in Hertford since 1827. "They just couldn't get the ingredients. People were fed up with cloudy pints, they desperately wanted consistency. So that's what led to artificial carbonisation". The dreaded Watney's Red Barrel, first trialled in Britain in 1936, was ubiquitous by the 60s.

Camra was launched in the early 70s, at the height of the Watney's Red peril, as the Campaign for the Revitalisation of Ale: "A bit hard to pronounce after four pints," says Benner. McMullen's, though, "stuck to our guns", and now, still family-owned, brews some 9,000 barrels a year of a range that includes its trademark Original AK, a lighter, brighter cask ale "that appeals to lager drinkers", and the "seriously grown-up" Stronghart, a 7%-strength (most beers are in the 4-6% range) dark ale described by those who know about these things as "liquid Christmas pudding". The company also owns 134 pubs across the northern Home Counties, which helps.

Fergus, the great-great-great- great-grandson of the company founder, admits to feeling a certain responsibility to his forebears in his efforts to brew the very best real ale he can. He's convinced the recent revival has been driven by "quality at the point of sale. People are more discerning; they want quality, and they're prepared to have a taste. It's all about the cask in the pub."

He's sanguine, though, about pub closures, the subject of an ongoing Camra campaign: "Look, bad pubs, non-viable pubs, should close. "They're unfair on the tenant, unfair on the brewery, unfair on the locals. Good pubs, well-run pubs, in the right place – they're thriving. We've got one, in the middle of a housing estate in Ware, no food, but by God it serves its community and it's doing brilliantly. We really invest a lot in pubs we think are viable; helping hard-working young entrepreneurs make them work."

The process of making beer may be relatively simple – add hot water to ground malted barley; extract the resulting sweet liquid or wort; add hops and boil for a bit; add yeast and ferment for a bit; condition in the cask – but the brewing business isn't always easy.

McMullen's has in its time survived more than one crisis (one early family member flatly refused to pay crippling death duties and took his case to court, fighting the Inland Revenue long enough and hard enough to be able to save the money to pay them, thereby saving the company from the otherwise certain fate of absorption into some anonymous conglomerate).

Down in Devon, Paul Walker, a former high-flying global pharmaceuticals sales executive who decided to do something else the day he came back from holiday to find 500 emails in his inbox, had to close his six-month-old business down in summer 2009 when the ale suddenly turned cloudy. His initial £50,000 investment more than quadrupled as, with the aid of friends, neighbours, eBay and a very patient bank manager, he all but rebuilt the brewery to get things right.

"I read a lot of books and went on a couple of courses," he says, "but my real training came from when things were going wrong. That's how you learn." Walking round Hunter's Brewery – essentially two sheds filled with stainless steel on a Devon farm – he explains the factors that will affect the character of an ale: the variety of barley, and how it's malted (the longer you toast the grain, the darker, smokier, more chocolatey the brew will be); the variety of hops, and when (and how often) you add them; the temperature of the mash and the fermentation; the timings.

Sometimes, though, the best discoveries come by accident. "We were brewing Hunter's Gold," Walker recalls, "a lovely, full-bodied golden ale. And we had a bit of a party at the brewery that night. So I came back the next day, and found we hadn't put enough hopped wort in the fermenter: it was only half full. It had fermented all right, but it wasn't Hunter's Gold."

What Walker had accidentally made was a potent 8% brew with strong malt flavours, a good floral finish, a surprisingly fresh taste and – let's be honest about this – a kick like a mule. The kind of beer, as Fergus McMullen likes to say, "that you're probably better off drinking after you've mown the lawn, rather than before". Like McMullen's Stronghart, Hunter's Full Bore has just made it through to the finals of the Great British Beer Hunt.

Winning would be a very big deal for both breweries. Sainsbury's, as Chadwick-Healy points out, sells 87 pints of beer a second. The vast majority of that, obviously, is mass-volume, pile-it-high, sell-it-cheap lager (far too cheap, incidentally, for the likes of Mike Benner, who blames much of the predicament of the British pub on the fact that big supermarkets sell some beers "six, seven, even 10 times cheaper than you can get them in a pub, against maybe twice as cheap when I was young. If you can get it for 50p in the supermarket, you're going to struggle, frankly, to pay £3 for it in a pub.")

That argument has never really applied to real ales, which have not traditionally been widely available in supermarkets and for which customers are plainly prepared to pay a proper price. Now, though, fast-growing demand for beers that would scare the pants off a Lagerboy is beginning to change the situation. True, not many supermarkets sell much bottle-conditioned ale, which, with its sediment of yeast, must be handled and poured with care, and is the only kind of bottled beer that purists consider real ale.

But volume is steadily rising. Hunter's Full Bore, for one, is unashamedly bottle-conditioned. And growing numbers of brewers – including McMullen's – now sell filtered and bottled versions of their ales that may not be "live", but taste a hell of lot more real than a can of Tennent's. Walker readily admits there's "a lot more profit" in bottles than casks, and Chadwick-Healy reckons off-trade or retail sales of traditional British ales will probably exceed on-trade (pubs) within the next couple of years. The beer revolution, Lagerboy, has only just begun.