Assuming your power supply will have the microcontroller to control the power, there are several ways to do this:
Always have a small voltage and monitor the current. When there's current, there's something connected.
Have a couple extra pins with a resistor or a diode on it, and use those pins to electrically control the power supply (note: this doesn't even require a microcontroller)
Have a physical switch in the socket to detect if something is in it
As with literally everything engineering related, be creative. When there's something you want to detect, always ask yourself what its effects will be. Is there a physical state you can measure (with a switch, or a magnetic breaking switch)? Is there an electrical state you can measure (resistance, or an closed circuit)? Then see how you can detect those and use them.
EDIT after your update:
Put a switch on the plug and turn it on when you need it.