Good question. I was going to say when the studio time/budget runs out, but really its done when artist, record company and who ever else is involved have approved it and positive reactions all round. All mixes are versions and the right mix is one finally chosen by artist or record company. The producer only really proposes and supplies mixes and its always the record companies prerogative which mix and tracks are used for release because they own the rights.
I think you know you've done it justice when you're happy and everyone concerned gets off on it.