How can civil ATC maintain safety with military aircraft around? I've been asking myself for a while how ATC can maintain air traffic safety with regard to military aircraft - or if they just don't.

As I understand it, all bigger planes (let's for now focus on commercial airliners) have mandatory transponders and warning systems like TCAS and similar. By usage of such systems, ATC knows their position, altitude, heading etc. which is used for planning of take-offs and landings just as well as air traffic safety. Also, systems like TCAS allow pilots to directly respond to unsafe situations even if ATC "didn't see it coming". In short, lots of regulations and techniques to make flying safe.

Now I know even less about military aircraft, but I do know they have transponders, too. I suppose, since enemies would have it a bit easy, those transponders don't operate the same way civil transponders do; or at least they use different frequencies, encryption and what-not. I don't know if they have TCAS but, I suppose, even that could possibly be exploited by enemies.

If I assume correctly, civil ATC cannot necessarily see military aircraft. I've read in another question that FAA doesn't have much power over military but that's just the US anyways. Also, the answer in yet another question suggests that military aircraft do not have to maintain separation.

So, what's the verdict? Do military aircraft assume civil regulations while not in "combat mode"? Or are civil ATC indeed oblivious of military air movements and the military has to provide safety by regulating military and watching civil traffic?
Military aircraft do have transponders that can reply to civil ATC radar and TCAS interrogations. Normally military aircraft operating in civil airspace are visible to civilian ATC and also will trigger TCAS advisories and alerts if they are getting close to airliners. 

During  wartime operations, and sometimes during combat practice in dedicated airspace, the transponder is operated in a different mode and will not be replying to civil radar interrogations. 

Typically when operating in civil airspace, military aircraft will fly under the civil regulations for that airspace. Training flights are usually conducted in dedicated airspace under military traffic control. 

In some cases the military ATC assumes responsibility over military aircraft in otherwise civil ATC controlled airspace. In such a case the military ATC will be responsible for the separation between the military aircraft themselves and between military and civilian aircraft. 

In other cases military aircraft may be allowed to maintain their separation from each other on their own, without civil ATC interfering in their operations. This allows for operations where military aircraft flying close to each other like formation flying and aerial refuelling outside the dedicated military airspace. In the USA these operations are called MARSA (Military Assumes Responsibility for Separation of Aircraft). Civil ATC is responsible for keeping Instrument Flight Rules (IFR) aircraft separated from MARSA operations. Visual Flight Rules (VFR) pilots have to maintain separation visually from MARSA flights and vice-versa. If VFR pilots are in contact with ATC they will be advised of ongoing military operations.