The ability, the facility button is straightforward. What’s complicated is what the computer does when it gets a signal. Typically, when the circuit is completed, the following occurs:
If the pc if off, a signal turns the pc on
If the computer is on, a signal tells the OS you pressed the power button. The OS then will either shutdown the pc or prompt you with what action you wish to take
If the computer is on, and a signal is received for five+ seconds, the pc powers off manually, bypassing the OS
The first two only require the circuit to be completed. I’ve turned my computer on mid-build by simply touching a car key to both pins for the power switch. Any metal object can be used as a makeshift power switch. Alternatively, any power switch you purchase at a hardware store can be used on a pc. Beware however that almost all such power switches are toggles: they’ll stay on once pressed or switched until pressed again or switched back into the off position. In other words, if you got a push-button switch like this, you’d actually want to click twice.