What happens if a passenger passes through the boarding gate, but doesn't get on the aircraft?
Passengers are counted before the plane leaves the gate. Since everyone's boarding pass is scanned at the gate, they know how many passengers should be on board. If that number does not match, it may be a red flag that someone has sneaked out.

The missing passenger can usually be located as using the lavatory, changed seat etc. As a last resort, the passenger's luggage is removed from the cargo hold for security. If things get to that stage, the flight is inevitably delayed for sure.