74HC595 and relays

Herodes:
When I finish connecting everything, my problem will be how to make a specific relay open or close with a button, which will be connected to a 74HC165.

You can use the shiftIn() function to read the buttons attached to the 74hc165. Alternatively you can connect the chain of 74hc595 and the chain of 74hc165 to the SPI pins and use SPI.transfer() to simultaneously read the buttons and set the relays.

You will need to study the "State Change" example sketch to learn how to toggle the relay output pins when a button is pressed.