How to connect 74HC165 ?

MAX, realizing you like the 595 means you have need of OUTPUTS... but if you need inputs... it's just not the right device.

As stated by crossroads, there are MANY options related to shift registers and the handshaking required is nearly identical in all cases. So, master one chip, and all the rest should be so much easier.

Once you understand how CLOCK, SELECT or LATCH and DATA work it starts getting fun.

A long time ago I built an extendable relay panel that allowed you to add or remove a board with 8 INPUTS and 8 OUPUTS per board. I used an INPUT pin on the controller that was fed to the LAST OUTPUT of the last board. Essentially, it was a form of feedback... during STARTUP, the controller sends out a data bit and keeps shifting bits until it sees that feedback pin change state.

This way you can daisy chain shift registers and not need any special code each time you add and remove them.