In HSL the math is simple — add 180 to the hue and wrap around 360 to get the complement. Saturation and lightness usually stay the same or shift only slightly.
It's the strongest contrast a pair of colors can have, which grabs attention but tires the eye if both colors are used in equal amounts at full saturation. The usual move is one low-saturation color as the large background and the other, more saturated, as a small accent.
Good for anything that needs to say "look here" — sports brands, CTA buttons, warning states.
When to use
When you need exactly one thing to pop — a CTA button. Keep the area ratio asymmetric, 5:1 or more.