How do you get headphones to work on a computer?

Basically, PC speakers and headphones usually have the same type of jack plug connector. If you've only got one sound output socket (and no headphone socket on the speakers themselves), you can just disconnect the speakers and connect the headphones instead.