How does the phone detect if 3.5 mm jack circuit is closed?
Headphone jacks have extra contacts inside, which act as switches.  The the drawing below, pins 4 and 5 are intended for sensing that the plug was inserted.  They are not intended for audio signal.  When the plug is not present, the switche, which are formed by 2 &amp; 4 and 3 &amp; 5, are closed.  When the plug is inserted, these switches are open.  The plug flexes 2 and 3 slightly, and they break contact with 4 and 5.  You could insert a 3.5mm plastic rod [a dummy] into the jack, which will open the contacts, and the phone might think that earphones are plugged in.



Source: datasheet for a typical stereo jack.