What mechanism does a brushless motor use to generate electricity
Same way as in a DC motor, except you get AC since a brushless motor doesn't have a commutator.  It actually doesn't matter if the magnets are in the stator or in the rotor, only that the magnets move relative to the windings.