All I know from Google searching is that they provide hearing protection and ATC communication maybe? Do pilots have to attach them or are they wireless? Who can the pilot reach using them? How much hearing protection does a pilot need? For instance, how does a pilot figure out how many decibels of protection is needed say for a Cessna 172? Must headsets always be worn? I'm interested in knowing all aspects of the uses of an aviation headset.
Aviation headsets are just like gaming headsets on a computer or console gaming system, except they are sturdier and much more expensive.
At the basic end of the spectrum, an aviation headset is just a big clamp style pair of around the ear headphones with a microphone. The cable from the headset has 2 plugs (for airplanes) or one plug (for helicopters). These two plug styles are equivalent electronically, with the helicopter cable having an extra conductor in order to include the microphone and headphones in the same plug. The two-plug variant has one plug for the headphones and one of the microphone. These differ from gaming headsets in that the headphone plug is 0.25" (the kind a nice stereo receiver uses) and the microphone plug is 0.206". This difference in sizes is to avoid mixing up which plug goes in which jack.
Aviation headsets fall into two broad categories: passive noise reduction and active noise reduction (ANR). The passive noise reduction headsets rely on a good seal around the ear and a strong clamping force (e.g. David Clarks). Active noise reduction are somewhat less "clampy" and provide less passive protection but make up for this with the active protection. An ANR headset is money well spent, but these do top out at around \$850-\$1000 for the top models from Lightspeed and Bose respectively. ANR headsets must be powered to work properly but all ANR headsets still function without power as passive noise reducing headsets. Power for an ANR headset can come from a battery box or from aircraft power but not interchangeably. Aircraft power requires panel installation of a plug specific to the headset brand (a single connector provides power, headphone and microphone connections). In general, unless you happen to own an airplane and install the power plug, you should get the battery version of a headset.
The primary purpose of these headsets is to reduce the noise in the cockpit (they can be very loud) in order to avoid hearing loss (yes, it is that loud) and to facilitate clearer communication with ATC.
For quieter airplanes there are in-ear headsets that have more in common with earbuds than the bigger headsets. Some of these are just earplugs wired for sound and some use molds of your ear to provide the seal.
The headset is connected to the airplanes audio panel. Audio panels vary in complexity but their basic job is to provide an intercom for communication between occupants of the airplane and access to the com radio for communication with ATC. The audio panel is also able to monitor (listen) the navigation radios certain types of beacons. In transport aircraft the audio panel is also tied into the passenger address system and the flight attendant's phones in the cabin.
The headsets can be operated in a hot mic setup or the mic can be explicitly turned on and off. The hot mic is the usual method and the audio panel provides a squelch control so you aren't broadcasting the cockpit noise when not talking. The ATC transmissions are via a push-to-talk (PTT) switch.
Aviation headsets for the most part do not need to be approved to use in airplanes, but in some situations for US registered aircraft, the requirement of an approved headset can be mandated (some (all?) 121 carriers). The FAA standards for approval are specified in TSO C-57a and C-58a. You'll find many, but certainly not all, aviation headsets conform to these orders. They define minimum performance characteristics of the electronics, speakers, microphones, etc that make up the headset.
How much hearing protection is needed depends greatly on the specific airplane in question. Jets can be on the very loud end of the spectrum (EMB-145) or they can be quiet enough that even passive noise reduction is largely unnecessary. For the noisy end of the spectrum peak wavelengths can be well in excess of 100 dB. I can find reports of 130 db in some smaller airplanes and reports of 84 db in a 737 during cruise, but these numbers are all anecdotal in nature. What is important to take from these is not the specific numbers but that they are high enough to cause hearing loss during prolonged exposure. The National Institute on Deafness and Other Communication Disorders defines 85 dB as the threshold for hearing damage from long or repeated exposure.
Passive headsets generally advertise noise reduction around 20 dB (23 dB for the venerable David Clarks) and some people will wear earplugs under a headset to further increase the passive noise reduction. A cursory look at ANR headsets reveal that they tend not to advertise their performance and instead specify maximum ambient noise levels for ANR to properly function (around 120-125 dB for Bose and Lightspeed headsets). I can personally add an anecdote that both the Lightspeed Zulu and Bose X make dramatic changes in noise level (both of these headsets are now outdated and replaced by newer versions).
For most smaller airplanes you will wear the headset from startup to shutdown. As you get into the large jets I have observed crews that wear minimal headsets during takeoff and landing, but not always during cruise. These airplanes were quiet enough that they were not needed. On turboprops and smaller jets that I have been in, headsets were worn throughout the flight.
On newer ANR headsets in particular you will find some extra features beyond just being a pair of headphones and a microphone. These extras include a 3.5 mm auxiliary jack to connect external music and bluetooth to connect your phone or other device to the headset. These typically come with circuitry to automatically mute or greatly decrease the volume of these inputs when ATC is transmitting.
An "aviation" headset is really not much more than an expensive set of headphones with a microphone. They do not do any radio communication by themselves, but are plugged into the aircraft radio system. There are wireless aviation headsets, but many pilots will likely prefer wired ones because there are fewer things that can go wrong (for example, you need to keep the batteries in a wireless headset sufficiently charged for your flight). You would still need to plug part of a wireless headset (not the part you wear) into the aircraft radio system.
Headsets are not technically required equipment, but small aircraft cockpits are pretty noisy so hearing protection is a comfort issue for the pilot (and passengers). Depending on where the pilot intends to fly, the ability to communicate by radio may be required (for example, through controlled airspace near an airport).
As has been described by others, a typical airplane headset will have two plugs, one for the microphone and one for the audio.
There's no regulation requiring use of a headset or a minimum level of sound protection. For airplane pilots, the universal use of headsets is a relatively new thing. In the 1980s and earlier, it was common for small airplanes to have a hand-held microphone that could be used CB-style, and a speaker mounted somewhere in the cabin. Most airplanes still have the (rarely used) speaker, but the hand-held microphones are becoming rare.
Interior cabin noise can be pretty loud. Without a headset, the noise level is not quite rock-concert loud, but it's definitely loud - about like the inside of a factory. With an ANR headset, it's comparable to riding in a car at freeway speeds. With a passive headset, it's in between, but closer to the quiet end than the loud end.
There are several advantages of an ANR headset as well as a few disadvantages. First, the maximum total noise reduction is greater. Second, the noise reduction is weighted more heavily toward the lower frequencies. It's possible to hear other sounds in the cabin more easily because the droning propeller noise is more strongly reduced. Finally, an ANR headset is lighter and more comfortable because it does not need as much insulation and clamping pressure to block out the noise. There are also some drawbacks. ANR headsets are more expensive. They do require batteries and these can die. (Power supplied from the airplane is a possibility, but most airplanes don't have the capability). A dead battery doesn't stop the headset from working, but the ANR advantages will be lost, and an ANR headset with a dead battery has less noise reduction than a passive headset. Finally, sometimes ANR headsets will pick up interference, which might be electrical or the result of a physical factor, such as a vent blowing on them in exactly the wrong way, which can confuse the ANR and make some unpleasant noises for the wearer.
Nearly all small airplanes have connections for at least two headsets. Most of them have a connection for every seat. There is typically an intercom in the aircraft that allows all the passengers and pilot to talk to each other and hear ATC. The pilot has a push-to-talk button on his control yoke that will enable transmitting on the aircraft's radio; anything spoken on the intercom is typically not transmitted. Most intercoms have a volume control and an "isolate" feature that isolates the pilot and radios from the passengers, so the pilot is not distracted by them. This is not a feature of the headsets, but of the electronics in the airplane.
While all aviation headsets serve the same basic functions, the more advanced ones have other features as well. Common features include Bluetooth to connect to a cell phone or music player, volume control which may include left/right balance or treble/bass control, an aux input jack for connecting to a wired audio source or cell phone, and an auto-mute feature that will disable the music source when radio communication is being received.
You can take a look at an ANR headset owner's manual here:
EDIT to clarify some of the questions asked. Most older planes have an audio panel installed, whether it was done when they were new or more recently as a refit. Some still have the handheld mic but others have removed it since it isn't really needed. If you were for some reason flying a plane that had no headset connection, you wouldn't be able to wear any hearing protection, as then you couldn't hear the radio or passengers. Gliders, of course, are quiet, so with them it doesn't matter.
The lifetime of ANR batteries varies but I usually get about 20 flight hours on a set.
If an ANR headset picks up interference it is just an annoyance. It's like having an insect buzzing in your ear.
Passengers don't need push-to-talk to talk to the pilot or each other. The push-to-talk is only to transmit on the radio. Back seat passengers don't usually have a radio transmit button and some planes only have one for the pilot.
Cell phones are prohibited in flight, but they can be used on the ground. Other than calling someone to come pick you up from the airport, you often have to call ATC and notify them that you've landed. If you're departing IFR from a non-towered airport, you'll also need to call ATC before you depart. If you don't have a phone connection, you have to do all this with the engine off (otherwise the noise is too loud).