Oxygen Sensors, often called O2 Sensors (O2 is the name of molecular oxygen) are found on every car with fuel injection. As the name suggests, they are designed to sense the amount of oxygen in the air passing by them.
Since the combustion process can be optimized with the right fuel/air ratio, knowing how much oxygen hasn't been consumed can help the ECU provide the best air/fuel ratio at any given moment. A high amount of unused oxygen means the amount of fuel that was used in the combustion process was too small to use up all the oxygen, which reduced the amount of power the engine could have made in that instant.
A malfuntioning oxygen sensor can result in both lack of power and poor fuel milage. Oxygen sensors can be found on both the intake and exhaust, but are more commonly found on just the exhaust. Oxygen sensors on the intake are quite rare, since the amount of oxygen in the air is rarely ever higher or lower than the average.
Since the catalytic converter is a chemical catalyst, having an O2 sensor before and after it will give a more accurate idea of how well the fuel is being burned in the combustion process.
What's Inside an Oxygen Sensor
Cleaning Oxygen Sensors
In some rare situations, an oxygen sensor malfunctions due to carbon build-up blocking the sensing component, or blocking the exhaust flow through the sensor's shell. If this is the cause of the malfunction, the sensor can be cleaned using an electronic parts cleaner, by submerging it in gasoline for a few hours, or (if you know what you're doing) heating the used end with a small torch (not to the point of glowing) and submerging it in water, then blowing it dry and repeating the process as necessary. These methods only work when the malfunction is due to a clogged sensor, and sometimes the cleaning process can damage the sensor, too.