Why is eating pretzels safe when they are bathed in lye?
Basically, the lye reacts with the CO₂ and moisture present during baking to form a non-toxic carbonate.  This makes it safe to eat.

The reaction:

CO₂ (g) + H₂O (l) ­&rlarr; H₂CO₃ (aq)

H₂CO₃ (aq) + 2 NaOH (aq) &rarr; Na₂CO₃ (aq) + 2 H₂O (l)

From here (MS doc) 

[EDIT]

Spurred by the comments, I have searched further.

tl;dr There is much going on wrt the lye dip. As far as safety goes, the lye is consumed in many reactions, including the above.


(Firstly: The equation source was not the basis of my answer; rather it was to refresh my memory of the reaction about which I was told/read several years ago was the reason why lye is safe to use on leavened breads, which was its combining with carbonic acid. (I apologize for not checking the balance adequately.)
My recent search only found one reference at The Kitchn to the reaction of lye with carbonic acid as the reason for its safe use. It is also unsourced.
Simultaneously, I found a research paper and a Food Chem Blog entry which referenced it, both of which discussed the behavior of the lye bath on pretzels. There is a lot there, so I shall only quote the paper abstract:



  The effects of alkali dipping on starch, protein, and color changes in hard pretzel products have never been researched. Experiments were conducted to mimic reactions occurring on the pretzel dough surface. Dough was dipped in water or 1% sodium hydroxide solution at different temperatures between 50°C and 80°C. Protein and starch profile after dipping were analyzed. Color development on pretzel surface following the extraction of pigments from flour was investigated. Whole dough and pretzel samples were also made at pilot plant and the properties were analyzed. Only starch granules on the dough surface were gelatinized following dipping. Amylose-lipid complex dissociated at a lower temperature with alkali treatment but were not dissociated, even at high-temperature dipping in water. Treating the dough at 80°C in alkali solution resulted in the hydrolysis of proteins into smaller peptides that could be not precipitated by trichloroacetic acid (TCA). Dough surface color was different following pigment extraction from flour but not significantly different following baking. The results suggest that the color that developed on pretzel surface was not due to pigments present in the flour but was contributed by the reaction within or between the starch and protein hydrolysis derivatives during baking.


and what I think is the pertinent quote from the blog:


  The protein results (2 in the list above [reproduced following]) indicate that the lye dip provides the smaller proteins needed for Maillard reactions, whereas the water dip does not. This seemed like perhaps the most important point to me.
  
  
  The dip resulted in the hydrolysis of protein into smaller peptides. This happened a little bit in 25°C water or lye dip, more in 80°C water, and a lot more in 80°C lye dip. Also, the smaller peptides in the hot lye dip had the smallest molecular weights; most of them “walked off” the electrophoresis gel, leaving no bands. The authors explain that the alkaline conditions of the lye dip result in like charges along the proteins, which repel and cause the proteins to unfold; this makes them more susceptible to hydrolysis.
  


Both the blog and the paper are worth reading.

My conclusion: the lye is consumed by the various reactions and therefore poses no safety concerns.