>>16000443You reject an egg that's been generated. Then you save. The next egg to be generated will have the same Destiny Knot stat distribution as the one you rejected. So all you gotta do is generate and hatch a new egg, then check its IVs t the Battle Institute and Kiloude. Once you know what IV is coming from which parent, you can reload your save, and switch out the parents to get your 5IV Pokemon.
However, waiting for the RNG to give you the correct distribution, as well as having the requisite IV setups to replace the current parents and get a pentaflawless mon is too much investment for it to be a regularly used method. I only resort to it when breeding genderless Pokemon like Rotom since I only have a 3IV as my highest Ditto. You're usually better off just breeding a ton of eggs.