How does ZK-snark work in zcash?
"[T]he process using ZK-snark" is to express the statement being proved as an R1CS system, produce proving and verifying public keys, produce and verify a snark-proof. A large non-trivial R1CS system is often expressed in terms of "gadgets" according to high-level "circuit structure".

A popular algorithm/proof was introduced at https://eprint.iacr.org/2016/260.pdf and implemented in libsnark. Zcash-specific "circuit" is documented in their "protocol" paper.