Excellent questions, and I have wondered the same.
But I am sure that overall, the miles usually net out at close to 0.
That is, the miles accumulated by members in any given FFP on a given partner over time will off-set almost exactly the redemptions by those
members on the same partner.
I would also suspect that on a multi-airline reward, the points are
apportioned in the same ratio as miles flown on each carrier.
I would also guess that the accounting takes place when tickets are
issued - that would account for the " no changes after ticketing" rules that
applies to Star rewards that may not apply to rewards wholly on one
airline.
It would be nice if an actual airline insider could give definitive answers.