How to wire headphone switch correctly in audio amp (LM4875) circuit?
The connector in Figure 27 is a switched mono jack plug. When the jack is inserted P2 is lifted and breaks contact with P3. For audio use P3 would be connected to the internal loudspeaker and inserting the headphone jack would disconnect it.

Your second diagram shows an unswitched stereo jack.



Figure 1. A switched stereo jack. When unplugged 2 connects to 4 and 3 to 5. Inserting the jack disconnects 4 and 5. Source: Switchcraft.

You need a switched stereo jack. It will have 2 P2/P3 contacts and (at least) five terminals.



To understand your Figure 27 we can see that there is a HP sense which, in the context, must be a headphone sense input. Without headphones, as shown, HP_Sense is pulled low by the 100k/150 voltage divider. When the headphones are inserted P3 is disconnected and HP_Sense is pulled high by R1. This can be used by the device to adjust the volume to the last headphone setting, etc.



Further clarification:

For stereo you will need two amplifier chips. Left goes to tip (3) and right to ring (2) of my Figure 1.

For a mono amplifier to stereo headphones wire 1 to GND and connect 2 and 3 to the amplifier output.