Once a year for cooling, in spring before the first stretch of real heat. A problem found in April is cheap to fix and easy to schedule. The same problem found in August is neither.
If you are close enough to the coast for salt in the air, treat once a year as the minimum. Corroded contacts and thinned coil fins are what we find on coastal systems that go two or three years between visits.
If the same equipment heats the house, or it is a heat pump running in both modes, the frequency depends on the use and on what the manufacturer requires. Tell us what you have and we will tell you what applies.
Check your own paperwork too: many manufacturer warranties require documented annual maintenance to stay in force.