Why redundant links are dangerous at Layer 2
You want two links between switches for resilience - but Ethernet frames have no TTL, so a loop lets broadcasts circle forever, melting the network in a broadcast storm. Spanning Tree Protocol (STP) solves this by logically blocking redundant paths until they're needed.
How STP picks the tree
Switches elect a root bridge: the one with the lowest bridge ID (priority first, then MAC address). Every other switch picks its lowest-cost path to the root as its root port; one port per segment becomes the designated port; the rest are blocked. If the active path fails, a blocked port takes over. RSTP (802.1w) does the same far faster.
Protecting the edge
Ports facing PCs should come up instantly (PortFast) and should never see switch BPDUs. BPDU Guard shuts a PortFast port if a BPDU arrives - stopping someone plugging a rogue switch into a wall jack and hijacking the root role.
EtherChannel: use both links at once
Instead of blocking a redundant link, EtherChannel bundles multiple physical links into one logical link - more bandwidth AND redundancy, and STP sees it as a single link. LACP (802.3ad, open standard) or PAgP (Cisco) negotiate the bundle; both ends must match settings (speed, duplex, allowed VLANs, mode) or the bundle won't form.