When ESD protection is necessary and where should TVS be placed?
It depends on what the headers head to. ESD is one thing but other types of damaging events can apply. Long wires, more than short wires, must be protected. Short wires or direct board to board, probably not, but a TVS against ESD adds to quality.

One problem can happen when users plug or unplug when it's hot (powered). Even worse when they plug connectors upside down. Even thought users are supposed to read instructions. Think about every scenarios before designing the protection. Sometimes a simple zener is enough. TVS diodes are used for medium to high frequency lines. They are better and more expensive.
The best is to read the data sheet in search for a "typical circuit" schematic and other recommendations. Also try to find tutorials or application notes about them.
for example this or this one

I would first put a resistor, the TVS diode, then a second resistor.

[pin header] --- vvv --- [TVS] --- vvv --- [ic]

The value of the resistors depends on the frequency. The highest the frequency the lowest the value. Maybe no resistor at all for high speed. I can't answer for that.
For very low frequencies or no frequency at all, I'd put 1k each. Depends on the type of signal.

The TVS should be connect to GND and/or Earth ground depending which type of surge or ESD you protect from.