The primary goal of any switch is to forward Ethernet frames to their desired destination based off the MAC address in the destination MAC field of the Ethernet header. The logic by which a switch forwards the frame is based on whether or not the switch is aware of where the destination MAC address is.
LAN Switch Forwarding Behavior
If the switch knows the MAC Address (Known Unicast) it will forward the frame out the single interface associated with the destination MAC Address.
If the switch does not know the MAC Address (Unknown Unicast) it will flood the frame out all interfaces, except the interface it received the frame on.
If the switch receives a broadcast frame, it will flood the frame identically out all ports.
If the switch receives a multicast frame, it will flood the frame identically to unknown Unicasts, unless multicast optimizations are configured.
Switches learn MAC addresses and the port associated with them by reading the source MAC address of received frames.