When is a rave illegal?

Seriously! I never knew what makes a rave illegal? Anyone know?