Modern networks use two forwarding models: routing (Layer 3) and switching (Layer 2).
Routers maintain routing tables and use protocols to compute efficient paths between networks. Ethernet switching takes a different approach: fast, inexpensive connectivity inside a local network.
Instead of calculating paths, switches rely on MAC learning. When a frame arrives, the switch records the source MAC address and the port it arrived on, building a forwarding table.
If the destination is known, the frame goes directly to that port. If it is unknown, the switch floods the frame to all other ports.
This makes switching extremely fast, but switches have no understanding of network topology, which creates a serious problem when redundant links exist.