Flushing machines exist although reports suggest these can cause problems by stirring up debris on older vehicles which can clog the valve chamber. Or you can do it manually, drain the pan and refill, pull a line off the cooler, pump out 0.5 l then turn off the engine, add in 0.5l fresh into the box, repeat pump out/replace until the fluid coming out turns from dark to light red.
Best not to let it get in too bad a state in the first place, do a pan drill/refill every couple of years once past 60k miles.