system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How do aircrafts know when they are being targeted?
gpt
Two basic ways:

Sensors on the aircraft detect the targeting radar of a ground installation or missile being pointed at the aircraft. Radars depend on hitting a target with energy and then detecting the energy as it bounces off the target and returns. Planes can detect when a radar is simply scanning the whole sky and when it is focused specifically on them by analyzing the radar energy hitting the plane. 

Missile Approach Warning systems scan the sky for missiles using pulse-doppler radar, infrared, and ultraviolet sensors. The radar can quickly detect objects moving fast towards the aircraft, and the IR/UV sensors look for the bright light produced by the missile's rocket motor.