Clear communication is essential to the safety of every flight. We communicate to announce our position and intentions at a nontowered airport, utilize flight following en route, receive clearance to land from air traffic control, and much more.
So what happens when there is an equipment failure and you can no longer transmit or receive voice communication?
If you're flying VFR (or if you're on an IFR flight plan but in VFR conditions), land as soon as practicable (according to Section 6-4-1 of the FAA's Aeronautical Information Manual). Locate a suitable airport nearby, overfly the field 1,000 feet above pattern altitude to observe the flow of traffic and identify the best way to enter the pattern, and then fly a normal entry and pattern for landing.
For aircraft flying IFR and in instrument conditions, FAR 91.185 details your next steps, including the route and altitude to fly, as well as when to leave the clearance limit. There's an order to follow based on various scenarios, such as whether you were being vectored at the time you lost communication, and determining the highest altitude based on where you are flying.
As a way to communicate with you as you approach a towered airport, ATC may use light gun signals. Although we learn about these during flight training, it's not something pilots encounter often—if ever—afterward. So it's a good idea to have a reference placard handy in your flight gear in case you need to refer to it in an actual radio failure situation.
Lastly, there are other ways to communicate if the radio in your aircraft stops working. Think about carrying a transceiver that could be used in place of your failed radio. Ensure it is charged and/or has batteries before every flight. And, since we all carry cellphones with us, you likely will already have yours somewhere in the aircraft nearby. You could use it to contact flight service (1-800-WXBRIEF).
More information about how to deal with a communications failure can be found in the AIM (6-4-1) and on the FAA Safety Team Aircraft Radio Malfunctions page, and there are many helpful resources online from the AOPA Air Safety Institute.