Two audio sources, one default and one 3.5mm audio jack, one output
Assuming the left most pin is the switched audio, you connect the RPI to that pin, which routes the music through to the middle pin. When you insert a 3.5mm connector, it breaks the switch, so the connector's audio routes to the middle pin.

See this schematic for how it works electronically.



RPI to 3, Audio Out to your speaker/audio circuit to 2, Ground to 1.

Make sure your RPI audio ground is also connected to 1.