It is possible to turn a Raspberry Pi on and off with a simple push-button switch and a small tool that is called pi-shutdown. The switch must be connected to the pins 5 (GPIO 3) und 6 (negative pole). If you push the button for about one second, the Raspberry Pi is shutting down and reboots. If you push the button for three to five seconds, the Pi is shutting down and turns itself off. If the Pi is turned off, you turn it on by pushing the switch.
Source: c't 25/2017, page 152