You resolve the issue outside of court via settlement agreement that stipulates confidentiality.
This is one of the reasons attorneys recommend settling out of court or not filing a lawsuit in the first place, if the issue can be resolved sans litigation.
Generally, when you sue someone in the US, it is a matter of public record. Certain parts of proceedings may be sealed to protect minors, but usually everything is heard in public, and all the documents can be accessed by anyone who wants them. Everything private gets aired in public in a lawsuit.
I'm not aware of any lawsuit where it was sealed in its entirety.
Judges may order media or the public at large to stay out of his/her courtroom, but there needs to be good reason for this (e.g. the Michael Jackson case).
*I am a CA licensed attorney; the information above is not legal advice but general principles, only. No communication with me shall establish an attorney-client relationship. Why am I here? Because I am bored, need a social life, and trying to make sure my law school knowledge isn't completely gone.*