In the same way that the big bech 4 host hackathons(ie recruiting events) at colleges and not retirement communities or really anywhere other than places where the highest population of the target demographic congregates.
If you were a qualified but rejected applicant, this ad targeting could demonstrate a pattern of behavior when you sued the employer for discrimination.
To provide a counterpoint, you can't legally advertise the fact that there are no blacks in your housing development, however true that may be. In fact, there are many types of dogwhistling that are also banned when it comes to advertisement of housing.
In the US, companies cannot discriminate against 40+ ages for hiring. But that in no way applies to advertisement.
If Facebook puts a job ad billboard in Seattle (mostly white), but not in Atlanta (mostly black), there's no illegal discrimination.
And for good reason: Marketing is always about reaching the most likely targets.
Another scenario: company creates company-jobs.com, which contains all their job postings. The homepage requires you to select your age range before accessing the listings, and only choosing "18-30" results in them being displayed. You're acquiring the individual's age range in advance - exactly the way an ad network does - in order to decide whether job listings should be displayed to a person belonging to that age group.
Direct analogy: the ad network is operating as a recruiter for the company. Recruiters are not allowed to discriminate based on age. End of story.
It could apply to say, requiring candidates to provide credit scores which disadvantages a protected class.
Are you sure that's true? Quite a few job-boards exist purely so large companies can show they've explicitly attempted to target veterans and so on.
See what happens.