How do airlines ensure each passenger has a life jacket before a flight?
It's essentially a manual check for many airlines, performed as part of the pre-flight checks.

However, the airline I have worked for recently upgraded from manual checks to RFID tags on each lifejacket (a sticky tag kind of like this). The RFID tags can be read from the aisle by a handheld reader. So the person who does the checks simply walks down the aisle with the reader and is able to tell if a seat is missing a jacket and also if the jacket needs to be replaced due to the expiry date fast approaching.

In addition to a tag on the actual life jacket there are also security RFID tags across the life jacket holster under the seat. So the scanner is able to tell if the life jacket has been tampered with as the security tag would have been broken.

As for the frequency of checks, different regions have different requirements. Usually life jackets are only needed at all if flying over a large body of water. I believe the USA requires a check before any flight which passes over the USA (as well as water). Europe requires less frequent checks.