Something that you might be surprised to learn is that pilots are not breathalyzed before every flight. There are some countries that take part in random testing, but this is not a routine thing. Pilots in both the US and UK are not required to take a breathalyzer before they take off.
Most of the time, a pilot will only be tested randomly, or if there is a reasonable suspicion that they are over the limit. Of the 13,149 people that were randomly tested for alcohol intoxication in 2015, only a small number of 10 of them failed the test. One of the main defenses against a drunk pilot is the eyes and ears of the crew and passengers on board.
Cabin crew are widely encouraged to report any suspected intoxication of a pilot or another crew member, and passengers can also reach out to a member of staff if they have any concerns. This is a very unlikely occurrence, but this does not mean that it will not happen ever.
Random testing is in place to keep people on their toes, never knowing if they are going to be tested or not, but perhaps this is not enough to deter people from drinking alcohol. If a drunk pilot gets on board the plane and has not been randomly tested, then it is up to the crew to raise any concerns if they have them.
Some countries do not think that these rules are acceptable, and they have much stricter ones in place. For example, in India, every pilot is required to take a breathalyzer before their scheduled flight, and they also must not drink alcohol more than 12 hours before the flight. Although, India is known to have a much bigger problem with drunk pilots, so this could be why the rules are stricter.