If you don't hear the noise of solenoid pushing pinion into mesh ( would normal be drowned out by noise of starter motor turning ) then the solenoid may be faulty. If solenoid is working it could be that the gear is sticking on its shaft and not moving forward fully sometimes, and the main contact does not close unless fully forward to prevent damage to teeth. Could also be loose cable connections on solenoid or motor.