There are umpteen variables including type of missile, your speed, your altitude, etc.
As for detecting an inbound missile, again there are multiple variables. If it's a radar guided SAM, your systems will tell you when the tracking station has detected you, when it has shifted to tracking mode, when it has a firing solution and has shifted to launch mode, whne you are locked on, and when the missile has launched. You will also be told what quandrant the missile is approaching from so you can look for it.
Your systems will also attempt to jam the missile tracking radar and after lock-on, will try to break lock. If the missile is inbound, your systems will try to jam its guidance or else spoof its guidance (fool it into missing you). this can be done passively with chaff, or actively with a jammer, and on new (US) aircraft, you'll have a towed jamming pod. If it's an IR missile and you have LIRCM, the system will fire the laser to destroy the missile IR seeker. If you don't have LIRCM, it will deploy IR flares to jam or spoof the missile's guidance.
If you're going to maneuver to avoid the missile, there are multiple options. If the missile is climbing and you're not too high up, diving down below and toward the missile is often effective. The missile will be forced to turn downward and inward while it is still accelerating and will need to pull enormous g to do it. Sometimes the missile breaks up. If not, it may not be able to pull enough g to stay with you and will miss. Sometimes the very high g maneuver will cause it to break lock, also resulting in a miss.
And of course there's also the Martin Baker option.