And I'm sure they have other ways that we can't think of.
If they have your car details up on the screen it's reasonable to assume they could display or otherwise know if the manufacturer ever produced a homologated HID kit.
If no such HID kit was ever manufactured and the car in front of you somehow has it, instant fail.
On the other hand, if you retrofitted HID or LED lights which are OEM original & homologated, whether available from factory as an option or only fitted to later models, it's hard to see how they could fail you.
In Spain it's been illegal for a long time to make any modification to car lighting (even fitting Cibies, rally lamps, light bars) without homologation and a certificate from a qualified mechanic. If they catch you will probably be fined and your car will be off the road until you return it to stock.
However an exemption exists for OEM / mfg original parts.... so retrofitting Smart(tm) brand front fog lights caused me no problems at all.