Even as electricity was restored across Spain and Portugal after a daylong blackout, residents tried to make sense of 18 hours of the “insanity.”