Headphones and speakers just receive an analog electrical output; the computer doesn't receive any feedback about their status or if anything is actually pl***ed in.

The problem is most likely with your sound card drivers or sound configuration. Try running the disc that came with your sound card, or downloading the latest drivers.