3.5mm audio jack to trigger 5V relay
Since you are pretty new to electrical engineering, I will give you a complete circuit, with explanation.

Turning on a relay requires a fair amount of current (~50mA) which is more than typical ICs want to source directly, so usually a transistor is used to take a small control current and switch on the large relay current. This circuit uses any generic PNP transistor, e.g. 2N3906.
The chip shown is any generic “open collector comparator”, e.g. one section of an LM339. These devices pull low (to ground in this case) when their ‘-‘ input is higher than their ‘+’ input. This condition happens when any audio signal shows up that exceed the threshold voltage (set by the 1M / 22K resistor but can be adjusted for your desired trigger point).
When a positive audio peak exceeds the threshold volage then the comparator goes low, discharging the capacitor and turning on the PNP transistor and hence the relay. The capacitor will continually get reset as audio continues to come in.
When audio stops, the comparator’s ‘-‘ input stays at ground and now its ‘+’ input is greater so the comparator goes high. But “high” for an open collector device really means that it disconnects entirely from the output so only the 1M resistor is left to slowly charge the capacitor, eventually all the way to the +V rail at which point the transistor turns off (because its base-emitter voltage is zero). The 1M / 1uF creates a time constant of a second or two that keeps the circuit on after audio goes away. Making C bigger will keep it on even longer.
The +V voltage rail must be chosen to match the relay’s specified voltage. Typical relay voltages are 5V, 9V and 12V. Depending on the +V you end up with you may want to fiddle with the 1M/22K values to get the audio turn on threshold right.
For simplicity you may be tempted to run the whole thing from a 9V battery. That would probably work but not for very long: the ~50mA constant current requirement would drain the battery quickly. Better to use 5V from a USB port or a 5/9/12V DC adaptor.
Lastly, a diode (any diode) is usually placed across the relay coil to give the pent up current in the coil a discharge path when abruptly turned off.