Hey there,
Before shutting down the router/switch, JUNOS will first increase the fan speeds and log a message. If despite the fans running at maximum speed, the component(s) are registering "over-temperature limit" values (slightly depends per platform), then the system will be shut down.
Cheers,