Fourth circuit - use a PC814.
However putting a LED indicator on the output side of the opto-isolator is generally a bad idea because the CTR may only be 1 (AKA 100%) or lower (Note the wide specs on the PC817!).
The opto-coupler should be close to the Arduino and connect between the input pin and ground using INPUT_PULLUP. No other component is necessary. If you still must add a LED (with a resistor), it goes from the pin to 5 V,
If you sample the output at no less than four times the mains frequency, you guarantee to detect presence of the mains within two samples.