What is a yaw rate sensor? What is the purpose of it? And where is it locate?
The yaw rate sensor is a key component in a vehicle’s stability control or electronic stability control system. Yaw can be defined as the movement of an object turning on its vertical axis. The yaw rate sensor determines how far off-axis a car is “tilting” in a turn using gyroscopes to monitor the slip angle, the angle between the vehicle’s heading and actual movement direction. This information is then fed into the vehicle’s computer to evaluate the wheel speed, steering angle and accelerator position, and, if the system senses too much yaw, the appropriate braking force is automatically applied.
By comparing the vehicle’s actual yaw rate to the target yaw rate, the on-board computer can identify to what degree the vehicle may be under- or over-steering, and what corrective action, if any, is required. Corrective action may include reducing engine power as well as applying the brake on one or more wheels to realign the vehicle.
https://knowhow.napaonline.com/electronic-stability-control-a-short-history/
You left out a few details.

It tells the computer when you’ve lost control of the vehicle, and it’s time to hit the brakes. No idea where yours is.