In short, the onboard Radar Warning System computer analyzes the data and determines whether the missile has locked onto the aircraft.
In general, aerial warfare is very complex and it is very difficult to explain in the real situations. Basically, the radars use different modes while engaging aircraft (from other aircraft or ground based SAM batteries):
First, the scan the area for any threats.
Once any threats are detected, they track the threats.
Once the threat is tracked, it is prioritized and the radar/missile locks onto the target.
Radars can change either the frequency or the strength between these modes. For tracking a target, the radar is basically scanning a smaller portion with higher intensity to get more resolution. So, the radar signals will be stronger.
Now, consider the dogfight scenario you mentioned; every radar in the area will be emitting electromagnetic radiation and get the returns from all the radars in the area. This is, to put it mildly, confusing. So the radars adjust the frequencies so that they have different values and track the aircraft.
Now, the RWR uses these two information to differentiate between the various radars. By looking at the frequencies/strength and comparing it with the available onboard library, it can determine which radar is emitting in which mode. In fact, creating this library is (one of) the most difficult things in design of ECM systems, which is the reason why everyone is trying to 'probe' other's defences.
This image shows a typical RWR display, where the threats and their locations are shown. The stronger the radar signal is, (probably) the closer is the radar source and more imminent is the threat.
Typical RWR display, from gizmodo.com
This display shows an F-15 at the 7-o'clock position and two surface-to-air missile (SAM) sites, an SA-5 "Gammon" and an SA-6 "Gainful", at the 12- to 1-o'clock position. The RWR computer has determined the SA-6 to be the highest priority threat in the area, enclosing it with a diamond.
There are other ways to determine of the missile is locked on the aircraft: you can use a doppler radar to track the missile and calculate the intended trajectory. However, this means exposing the aircraft to the radars in the first place.
Once the onboard computer analyzes the data and determines the the threat and severity, it alerts the pilot, usually by changing the display and in some cases, by audible alerts. In such cases, the pilot can release the countermeasures or the system can do so automatically.
However, the real situation will be much more complex with all the countermeasures, ECMs and ECCMs etc. But this should give a basic picture of the situation.