It is illegal to sell alcohol to a minor in Washington (RCW 66.44.270). The seller can get into various kinds of trouble, including losing their license, under liquor board regulations. However, as long as the establishment follows the rules for acceptable ID, they escape liability if in fact they sell alcohol to a minor: the license holder is legally allowed to accept an identification of the specific type. That is the sense in which this is required by law: the customer must have actually presented the identification, in order for the establishment to escape liability (RCW 66.20.210). Looking old enough is not the issue. It is legal to sell alcohol to a person who is over 21, and the law does not require presentation of identification as a condition for a sale. However, under RCW 66.20.180 a person is require to produce ID "upon request of any licensee, peace officer, or enforcement officer of the board". The legal risk attached to sales in an age-marginal situation is very high, and actual presentation of ID is required to escape liability by the establishment, so in that sense, it is "required by law".
All requests to produce ID for liquor sales (at least in Washington, and leaving out deliveries which are governed by other laws) are driven by company policy. Typical policies are quite rational, being designed to protect the company's interest in not getting into a heap of trouble for an under-age sale. There is no law saying when you must ask, or when you are protected if you don't ask. Usually, store policy is to use "common sense" so that 90 year olds are not required to produce ID (they may be asked, jokingly).
Non-compliance with RCW 66.20.180 carries no legal penalty, that is, there is nothing in the statute that says "if the customer doesn't...". The most obvious would be that the seller would refuse to sell, which the seller can arbitrarily do anyhow. There is no statutory penalty imposed on a licensee if they request ID of a person over 21 and the person fails / refuses to produce the ID. Obviously, the licensee cannot be punished if a customer fails to provide ID (and leaves), especially if they lost it. But the law "requires" them to provide an ID, with ne except "unless you leave / put the bottle back". Somewhat less obviously, if the legislature wants to, it can enact a provision that once a licensee requests ID, they are forbidden to sell alcohol to that customer until ID is provided. But there currently is no such law.
"The law" also included regulations, such as WAC 314-17-105. This regulation is a chart, and the relevant entry is
PERMIT: Failure to produce permit or identification upon request. See
RCW 66.20.310 and 66.20.180.
for which the 1st offense consequence is "5-day permit suspension OR $100 monetary option". This is a problematic regulation (potential lawsuit fodder), since it can be interpreted in a number of ways. The question is, of whom is the permit or identification predicated? Only the licensee has a permit, but customers and employees can both have identification. If we interpret this regulation as meaning "Failure by licensee or customer", then we arrive at the absurd conclusion that if a customer fails to produce ID on request, the establishment is fined. It is important to note that this regulation is under a chapter about server training, thus the regulation can only reasonably be interpreted as being about licensee providing identification.