There are several factors that interact with each other.
The length and diameter of the wire determines the wire resistance and thus the power dissipated as heat in the motor.
The mass of the motor core, frame and windings determines how long it takes for the wire to reach its maximum safe temperature.
The surface area, shape, enclosure style, air temperature and air flow determine how quickly heat is taken away from the motor.
The insulation type determines how hot it can get before being damaged. Magnet wire insulation materials have historically ranged from 100 to 180 degrees C. There may be newer materials that can operate at even higher temperatures.
The duty cycle, operating vs. cool-down time, influences the maximum temperature.
Te expected lifetime of the insulation is directly related by the time that the insulation is subjected to a given temperature.
Industrial motors are designed to operate 24 hours a day, 365 days per year for many years. Hobby motors have duty cycle limitations and shorter life expectancies. Automobile starter motors have duty cycle limitations.