Scary stuff. However, it's not total panic in the skies when this happens.
There are defined procedures for lost communications that every pilot is trained and examined on.
- pilots continue to fly usually the previously assigned route. There are a bunch of rules designed to minimize the risk of collision.
- When there is visibility, old fashioned see-and-avoid is very much in play. There are basic right-of-way style rules that prevent collisions. However, even in good visibility it is hard to see other planes at typical distances and speeds.
- Most planes, and all of the commercial passenger liners, have TCAS based on ADS-B. This is a peer to peer transponder system that can issue resolution advisories with guidance to both aircraft to prevent a collision. No ATC infrastructure is involved.
- ATC towers have red/green light guns that they can use to signal pilots. There are defined signals to issue instructions and landing clearances.
- The 3D volume of airspace is so vast that collisions are normally pretty difficult. En route traffic is channeled onto airways, but the airway corridors are usually at least 5 NM wide, and traffic in opposite directions are on alternating altitude assignments. The main exception where collisions are risky is in the terminal area, where a whole bunch of planes are trying to get to the same limited runways. That's where collisions happen and where ATC is the most important.