I suppose it triggers when mIRC failed to connect to an irc server after all the retries.
"The on CONNECTFAIL event uses the same as above and triggers when a connection attempt (including all retries) has failed. $1- is set to the connect error message."
This is from mIRC help file, have you read this? What part didn't you understand?