Electrical fires and accidental electrocutions are very real hazards inside homes and buildings. Thankfully technology and building codes are advancing to help minimize those problems.
There are two general types of electrical protection in wiring. One is an Arc Fault Circuit Interrupter (AFCI) and the other is a Ground Fault Circuit Interrupter (GFCI).
The AFCI is a circuit breaker and is installed at the panel. This device detects when there is an unintended electrical arc. Essentially, electricity is flowing between two locations that it should not. The breaker can detect this abnormal electrical arc and turn off the power before things get to hot and a fire starts.
Odds are you have seen a GFCI outlet on a regular basis. These are the outlets that have two buttons between the outlets. This type of protection is to prevent or minimize electrical shocks. It does this by measuring how much electricity is leaving the outlet and how much is coming back in. If these are different it assumes that electricity is going down to the pool of water you are standing in. It then shuts off power at the outlet.
AFCI reduces the fire risk to the wiring in the wall.
GFCI reduces the risks of electrocution and are required near water sources.