Motor overheating happens when you're pulling more current than the motor can efficiently handle or dissipate as heat. The most common culprit I see is prop choice. Running props that are too aggressive for your motor creates excessive load, forcing the motor to draw way more current than it should. For example, putting a 6-inch aggressive pitch prop on a 2207 1800kv motor will cook it fast, whereas a 5-inch or lower pitch prop would run cool.
Damaged or unbalanced props are sneaky heat generators. Even a small nick or imbalance forces the motor to work harder fighting vibrations, which translates directly into wasted energy as heat. I always check props before flying and replace anything that's seen a crash. Spending two dollars on new props beats replacing a forty-dollar motor.
Your ESC settings matter more than most people realize. Running desync protection too aggressively or having timing set too high increases electrical resistance in the windings. I've seen motors drop 15-20 degrees Celsius just from optimizing ESC timing and motor timing settings in BLHeli configurator. Start conservative with timing around 16-21 degrees and only increase if you need more punch.
Physical obstructions blocking airflow will absolutely murder your motors. Some frames have tight motor mounts or carbon plates that restrict cooling airflow. The bell needs to spin freely with air flowing through the stator. I once had a frame where the arms blocked about sixty percent of airflow to the rear motors, and they'd hit 95 degrees Celsius while the fronts stayed at 65.
Sustained full throttle is another killer, especially on racing quads. Motors are designed for dynamic flight with throttle variations, not wide-open throttle for thirty seconds straight. If you're doing long-range cruising, you need efficiency-focused motors with lower kv ratings, not high-kv race motors.
Motor quality plays a role too. Cheap motors often use inferior magnets and thinner wire gauge in the windings, both increasing resistance and heat. The difference between a fifteen-dollar budget motor and a thirty-dollar quality motor is significant in thermal performance.
Finally, check your motor screws aren't over-tightened. Cranking them down warps the bell and creates friction between the bell and stator, generating unnecessary heat. Snug is good enough. I finger-tighten then give maybe a quarter turn with a driver.