What happens if an unmanaged ethernet switch is looped (connected to itself)?
Solution 1:
Auto-sensing versus a crossover cable
If the switch's ports do not auto-sense the orientation of the tx/rx pairs, then absolutely nothing will happen because you've probably used a straight-through cable; the type of cable you'd normally use to connect a workstation/client to the switch.
So, instead let's assume you've used a crossover cable, or much more likely, you have a non-stoneage switch with auto-sensing tx/rx orientation, then...
"Dumb" Switches
You have just created a loop in the network topology. In a moment or two, your network, (all the segments off this dumb switch) will probably stop working as the dumb switch sends the first broadcast packet out one of those two switch ports, receives the packet on the other, and then sends it out the other, etc. Packet storm, meet network, network, this is a packet storm. The switch will probably, (hopefully) squelch the storm, things will come back to working... until the next storm comes along shortly.
So let's assume you're not using "dumb" switches, then...
Managed Switches
Managed switches almost always have loop detection, called Spanning Tree Protocol. When a port comes up with a new link, the switch does not immediately join it to the switch fabric at-large. Instead, it segregates the new port(s) and uses STP to see if a loop would exist if the new port(s) were added to the fabric. (In real-world networks, the loop might not be nearly as obvious as one mis-plugged cable.) Some people, (known as "novices") disable STP so the switch ports "come up" faster. This is great, until you discover why you need STP.
VLANs
(See also Introductory Level... or our VLAN tag.)
If the two ports are administratively configured in two separate VLANs, then you may well have intentionally wanted to put that cable there to provide connectivity between the VLANs. (But really that makes little sense. Change you're VLANs, or redesign the network, etc. instead of adding a wacky cable.)