No signal detected by second monitor
While troubleshooting a problematic external USB drive, my second monitor went blank. The message on the monitor said no signal detected. I tried shutting down, disconnecting and reconnecting the monitor, then restarting. Nothing. Finally after shutting down and leaving the Mac off for a couple of hours then restoring, the monitor came back on. So, the problem is resolved but I'd like to know why it happened. And how to fix it in a more timely manner.
iMac with Retina 5K display, OS X El Capitan (10.11.5)