Practically speaking, in general, you can't.
By 'in general', I mean, 'you are part of the 99.99% of people who post up something with a FLOSS license.' You will have some users scattered all over creation. You will have no visibility into what they do. You may well have someone who uses your code in violation of the license.
If you are in the unusual .01% (numbers invented) you have created something with tremendous impact on the marketplace, like MySQL or Linux or the like. In which case, you might end up noticing some inappropriate use. See, for example, BusyBox.
The detection mechanism here is not technical. How could it be? Starting from the source, a bad actor can remove anything you leave in place to try to detect usage. Rather, it depends on (a) wide usage, and (b) conspicuousness, such as, well, a shell.
If you post some clever image analysis algorithm, and someone adapts it and incorporates it inappropriately, you have very limited means of noticing.