How does a switch operate at Layer 2 of the OSI model?

Technical