The switch builds up a table with the MAC address of every device that is connected to each of its ports. When a signal is received, the data is analysed to determine the destination MAC address. The data is then sent to the port connected to the device with the MAC address.