If you read this, you'll find that the CIC chip is actually a primitive 4-bit CPU with a small bit of ROM. The chip in the NES and the chip in the cartridge attempt to communicate, if expected communication does not happen the CIC resets the system.
There is one chip inside the console, and one in every cartridge; the code inside the chip decides what to do based on a pin strap (the console one will be the “lock”, and the cartridge one will be the “key”).
The two chips run off the same clock, and they run the same code, so
they run in lockstep (sometimes they execute different codepaths, but
the code is careful to take the same number of cycles on both paths in
these cases).
The chips communicate over two wires, one from key to
lock, one from lock to key. Both chips calculate what bits they will
send, and what the other guy should send; if what they receive is not
the same as what they should have received, they panic, and the lock
chip resets the console.
By cutting the correct pin on the NES console CIC chip (a well known trick), I think what happens is that it changes the CIC from "lock" mode to "key" mode, and the "key" mode doesn't issue any reset.
Some unlicensed carts had another cartridge slot on the game itself and you were required to plug in a second game into the actual game cartridge, I suppose this just passed through the CIC from the second cartridge to the console.
According to the Wikipedia article on this, the hardware in some unlicensed games sent a voltage spike to the CIC, stopping it from working, as well as the above pass-through method. Tengen developed a chip to duplicate this functionality called the Rabbit Chip, and was sued by Nintendo.