The job of a switch is to process incoming frames with the objective of getting them to their appropiate destinations based on the destination MAC address which can be found in the header.
There are multiple decisions a switch can make for each received frame, which will differ based on the type of destination MAC address and on whether the destination address has been learnt and added into the switches MAC address table.
Here is an output of MAC address table from one of my study switches:
For a frame that has a known unicast address - an address that the switch has an entry for in it's MAC address table, with associated interface is forwarded out of the single interface.
For a frame with an unknown unicast address - an address that the switch does not have an entry for in it's MAC address table, will be forwarded out of all ports within the same VLAN except for the port it was received on.
For a frame with a broadcast address, the frame is flooded the same as a frame with an unknown unicast address.
For a frame with a multicast address, the frame is again, flooded the same as a frame with an unknown unicast address, unless multicast optimisations are configured.
Switches learn MAC addresses, and add them to their MAC address table by reading the source MAC address of received frames along with the port they were received on.