My understanding is that polygraphs “work” because people think they do. The machine _will_ catch you lying, so if you do, you get scared. Training to beat the polygraph mostly involves breaking this belief.
There are other ways, too. But even without it, the limited scientific evidence suggests that different polygraph operators show basically no agreement on analysing the outputs. It’s pot luck and gut feel, which, well, works somewhat, but the type 2 error is so big that it is an unfair tool to use.