How do combat jets know when to launch flares to counter IR missiles?
Actually most aircraft don't actively know when a missile is being fired at them. I have worked on helicopters and fighters that deploy counter measures. 

The first is an IR jammer which we call a disco ball. It is made up of mirrors at different angles that resemble a disco ball. It radiates an IR signal at different angles to confuse the missiles.  

The flares or chaff are fired periodically in known hot spots. This creates heat signatures similar to the engines and confuses the missiles.  

There are active systems but they don't work well. I have seen a helicopter in testing suspended from a wire with countermeasures turned on. A missile was fired and the countermeasures didn't even get deployed. This is why they usually keep firing the flares or chaff in known hot spots. 

Hope that helps.