Your questions been answered in a million other threads on here even just going to google and typing in when & how to flush a pot plant gives you the answer...
But thats ok I'll tell you anyways
How to flush:
slowly fill your pot with 3x it's size in water (test ph or use distilled water)
When to flush:
I generally flush once maybe twice in the whole process, once when switching from veg nutes to flowering
nutes (I don't always do this), and then once 2wks before harvest (this flush is much more important)
If you have a set feeding schedule in which you feed heavy then water heavy you should not have to flush
more than once or twice the whole process.
If you do over-feed and develope nute burn thats also a good time for flushing.