I'm in med device manufacturing. I'll try to explain what I know about sampling, but statics are not my specialty
For each type of in-process sampling we do, we have a documented sampling plan based on ISO 2859-1. Sampling is based on severity of the issue being checked (i.e. patient risk), detectability, and the level of validation of the relevant product / processes. For some (not all) processes where we sample, we have a documented second/double sample plan.
So for example, we have a process where we sample a dozen or so parts out of a batch of >1000 parts. This is based on ISO 2859-1, Level 2-4, AQL=1.0, single sampling. There's some variability in the process - the beginning of the batch could be slightly different from the end of the batch, and there's different positions that each see slightly different processing. The sampling specifies picking samples from the beginning and end of the batch, as well as each of the different positions to make sure the samples are representative of the batch.
When we have a failure, it usually applies to the entire batch (it's not that much variation), so we do often reject the batch even after investigation. Sometimes, the failure applies to one specific location within the batch. So let's say there was an issue at the beginning of the run - we could determine where the issue was resolved, reject all product to that point, and retest to confirm our correction was accurate.
The real value doesn't come from saving a batch here or a part of a batch there, though. It's doing the investigations, finding the root causes, coming up with appropriate corrective and preventative actions, and incrementally improving the process. I've seen plenty of issues that had a risk of a patient receiving a substandard product or were costing us big money every year go away completely because of good deviation management and good CAPAs.