A modem works by modulating digital signals from a computer into analog signals for transmission over telephone lines. It then demodulates analog signals received from the telephone lines into digital signals that can be understood by the receiving device.