There have been very few (I think only one) deaths during freediving competitions, where protocols are used to guarantee the security of the athletes. Remember that you don't die of a black out, you die of drowning because you inhale water during a black out. As said in another comment, the black out is a protective mechanism when you run low on oxygen, but the breathing reflex is triggered by high CO2. Freedivers train both to sustain low oxygen (by doing long breath holds) and high CO2 (by doing repeats of shorter ones).
Monitoring a static apnea is pretty simple if you just pay close attention: when a black out happens, the diver will usually release a lot of air for instance, and pulling them out of water before they drown is what you do. Then you slap them to wake them up :)
In open water competitions, these days divers are tethered to the dive line, announce their target depth and can't go past it. They also announce an expected dive time which is used to plan the start of the safety divers. These safety divers escort the athlete on the end of the dive up (sometimes, as deep as from 30m), staying close enough to grab them if needed, but never touching them (that would disqualify as assistance). There is also a counter weight in place to bring up everything quickly in case something goes wrong deep. Issues are usually happening close to the surface (let's say in the last 10-15m); deep blackouts are very rare and usually a consequence of other problems like being disoriented if you get a ruptured eardrum.
Recreative freediving is a wonderful activity with very little risk if you just use a buddy system and don't push the limits beyond what both of you can do. It's good for you body and your mind!