Weirdly if the beer is flat, it's most commonly caused by scale deposits picked up in the glass from the glasswasher.
Beer recipies have continuallyt changed over the years (eg. since 2011, the strength of a lot of them have gone down and some have been reformulated to used a mixed gas instead of pure CO2).
To prevent the most common cause of flat beer, the glass washer needs to be regularly cleaned, a water softener needs to be fitted which needs regenerating or regular maintenance (depending on type), especially in hard water areas.
(It doesn't help the weird idea that a lot of bar staff have, that if you want a pint to be fizzy, they need to beat all the gas out of it whilst they're pouring it).