Some airplanes have a button for the "yaw damper."
- What is the yaw damper?
- When is it used?
- Is it ever required for certification or operation?
- How does it work?
The yaw damper is, in simplest terms, an "autopilot" for yaw. When engaged, it operates the rudder (or whatever yaw control method is available in exotic aircraft, like the B-2 flying wing).
Its primary goal is to counteract the typical Dutch roll aerodynamic mode of many aircraft. It also helps keep turns coordinated by automatically providing the necessary rudder inputs to avoid slipping/skidding in a turn.
In normal aircraft the yaw damper is part of the automatic flight control system (AFCS) or "autopilot." It can usually be engaged on its own without the rest of the autopilot. On the other hand, most autopilots require the yaw damper to be engaged when the rest of the autopilot is engaged (you can have yaw damper without autopilot, but not autopilot without yaw damper).
For large / transport aircraft, the yaw damper is usually engaged throughout the entire flight profile except for takeoff and landing.
It is required equipment (link is to FAA certification regs but similar regs apply elsewhere) in many (most?) transport aircraft, which tend to suffer Dutch roll instability, but flights can sometimes still be made if the yaw damper is inoperable per the minimum equipment list (MEL), with restrictions. This depends on the exact aircraft type and any extra operator policies (company rules). Note that usually an inoperable yaw damper also precludes the use of the rest of the autopilot.
Modern digital yaw dampers are part of an integrated digital autopilot system. They use accelerometers and rate sensors to determine the aircraft's motion. It then runs the numbers through special algorithms to determine what rudder inputs need to be made in order to damp any Dutch roll and to coordinate a turn. It then provides those rudder commands to a servo or hydraulic system which operates the rudder.
What is the yaw damper?
The yaw damper is a Stability Augmentation System
from Aircraft Control and Simulation
How does it work?
It is an automated system that uses the yaw rate of the aircraft (the aircraft thus need to be equipped with a sensor able to measure it) to command the rudder (the aircraft thus need to be equipped with an actuator capable of deflecting the rudder without pilot intervention) in such a way that the yaw oscillations will be damped faster than naturally.
Most aircrafts are naturally stable around the yaw axis (called "Weathercock stability"), but such natural stability (mostly due to the vertical part of the tail) might not be very damped, meaning that if uncontrolled, oscillations around the yaw axis would continue for a long time before dying off.
The yaw damper aims to reduce the duration of these oscillations.
When is it used?
Whenever there is the need of it.
Usually it should not create problems to the pilot or the safety of the aircraft, but there might be situations in which you might want to disable it, such as when you have to quickly perform a de-crab: a traditional (yaw-rate based) yaw damper would slow down the maneuver.
Is it ever required for certification?
N̶o̶t̶ ̶t̶o̶ ̶m̶y̶ ̶k̶n̶o̶w̶l̶e̶d̶g̶e̶.̶
Thanks to dvnrrs for pointing out that yaw dampers are required for certification of transport aicraft whose flight-test-demonstrated Dutch roll instability exceed certain limits. The relevant requirements are in 14 CFR §25.181.
Is it ever required for operation?
As dvnrrs mentions in his answer, higher level autopilots are usually not engaged if the SASs are deactivated.