I have a power supply pcb combinated board with 12V for PC fan and 5V for Power In on raspberry pi 4.The power supply is turning on with on/off button. When I shutting down the raspberry I want to stop the 12V fan. I will use the relay, but I don't know how to program and which two pins of GPIO to operate the relay. I'm knew guy with Raspberry Pi and python at all, so please help me.
There are 3.3V and 5V Pins on the Raspberry Pi that remain on as long as the Pi is being given power. GPIO Pinout and other info here. You can use one of these to control your relay, without the need for writing code.