What is the science behind the electric guitar?

The stings frequency varies depending on how short or long the string is when played.
That frequency excites the magnetic poles and windings around it and sends small voltage signals to the amplifer that boosts the signal so you can hear it. Same concept as the telephone.