How to detect which wire is live and which is neutral with Arduino?
There is no "correct" way with european plugs. Live and neutral are interchangeable. If you want to be sure you switch the live pin you will need to switch both pins together.

A DPDT or DPST relay (Double Pole, Single/Double Throw) is the simplest option.

There is no way of knowing which pin is which since they both have exactly the same current flowing through them (if they didn't your RCD would trip...)