24V Isolated digital input protection TVS
To answer your question, let’s evaluate the failure modes(or in simple words ways to break your circuit) and then apply protections.
Assuming that your 24V signal comes from a wild industrial environment where everything is possible we could have the following scenarios:
1. Reverse voltage applied on Common and 24v signal,
2. Very high transient voltage applied with positive or negative polarity.
3. High frequency noise riding the 24V or common wire due to machinery operating in the vicinity.

Now to protect against all of these your circuit does need to have a TVS diode, an RC filter and these located such that these devices would not be compromised in any of the failure modes defined above.

Having a TVS diode like SMBJ28C is a good idea but directly putting it on the input would risk damaging this component as early as a higher voltage is applied on 24V line as the current may exceed the max current rating of this component. So it would be better to have this TVS diode after the resistor. 

You may decide to add a small bipolar capacitor after the resistors to create a low pass filter and block higher frequency noise from randomly triggering the inputs of your micro controller. 

If you shift your TVS after the resistors then you don’t really require D4 because your TVS is doing its job and wouldn’t really allow the voltage on your optocoupler input to go outside the -28v to 28v voltage range.

The answer to your third question, you shouldn’t make ground common unless it’s really required. This is fundamentally why isolation exists and if you connect ground and common then technically your micro controller isn’t protected at all.

Adding to the same point, you can have a button for testing but you should provide it power from an isolated source like a 9V battery or so. You can’t use your circuit’s power without compromising the isolation. 

For your resistors just rerun the numbers to evaluate whether you would provide decent current to the optocoupler’s internal Diode so it powers up properly when a valid 24v signal is applied. 

Typically the current through a diode can be calculated by the quation below:

Vsource - Vbias = R * I

Where R is total sun of resistances before of after the diode. You must keep Current at the optimal range by playing around with resistor values.

Hope this helps.