Flightradar24 and most other only ADSB based tracking sites filter out the majority of military flights (I beleve). ADSBExchange (https://globe.adsbexchange.com/) on the other hand does not, they claim that if they have the data in the system it is public. And as you said, if the military don’t want to be seen they can just turn off their transmitters.
I live near a number of RAF and US Air Force bases in the UK. As far as I can see all RAF flights are visible on ADSBExchange. However, we quite often have US F16s fly over and they quite often are not tracked. So either they have permission here in the UK to turn off their transmitters (not convinced), there is a signalling issue, or ADSBExchange are filtering some data. It does appear to only affect US Air Force flight here though…
They could also be switching the transponder to Mode 3 (equivalent to civilian Mode C) which is not ADS-B compatible but would still show up on normal normal civil radar scopes.
Or they can use some military only modes. Some of those could in theory be shown on civil scopes, but I'm not sure they actually are, while others like mode 4 or 5 cannot. But they could show up on the UK's military scopes, given nato intercompatibility.
Another theoretical option would be for the air force planes to be using mode-S, but having disabled mode-S extended squitter (which means the planes don't periodically broadcast their location, but simply only reply when interrogated by radar). I would expect ADS-B receiver to pick up on these periodic interrogations though. I'm not sure if interrogation responses are directional, but even if so, some receivers would probably be in the general direction of the radar site.
Its not really clear which. Outside of wartime, normal US Air Force policy is to fully integrate into the civil ATC system, except in special military use/training areas or certain special missions. This integration just makes things safer for everybody.
I live near a number of RAF and US Air Force bases in the UK. As far as I can see all RAF flights are visible on ADSBExchange. However, we quite often have US F16s fly over and they quite often are not tracked. So either they have permission here in the UK to turn off their transmitters (not convinced), there is a signalling issue, or ADSBExchange are filtering some data. It does appear to only affect US Air Force flight here though…