The process is normally pretty safe and, out of the hundreds of cases, I don't know of one that resulted in a lawsuit.
On the other hand, since I also do litigation, I have witnessed a variety of these situations that have resulted in lawsuits and have occasionally defended them.
What is the difference between the safe and the unsafe ones? The standard safe zone is well-known in the Valley: do the side activity strictly on your own time and without using company resources.
Where people trip up:
1. Doing side activity that is related to the employer's current or anticipated business.
2. Failing to comply not so much with the terms of an employment agreement but rather with "company policies" that large employers will periodically require their employees to sign - policies that can require the employee to report all side activity and to sign a form affirmatively attesting either that there is none or explaining what it is. (If you lie on this, you get in trouble).
3. Crossing the line in violating fiduciary obligations that an employee has to ensure that all activity for which the employee is compensated is done strictly for the benefit of the employer.
The really critical area tends to be the last point. I don't know how many times over the years that I have seen founders get tempted to want to: (i) steer current customers of their employer in the direction of their side venture; (ii) sign up key customer or supplier contacts of their employer as "advisors" for their side venture; (iii) talk to co-employees about joining their side venture; and (iv) the worst temptation of all (but thankfully rarely done) use an inside contact at their employer's business (or use their own position) to steer project work toward the side venture.
The simple rule is to play it straight. Avoid conflicts. Make sure any IP you generate in your side venture has no material connection with your employer's business. And then follow the standard rules (own time, own resources). If you do these things, you will normally not incur any significant risk from moonlighting. (Of course, check with a good lawyer in your local area on details for your particular situation).