Oxygen sensors also known as o2 sensors will go bad somewhere around 60,000 miles. When an oxygen sensor goes bad your check engine light will come on. You will need to have your computer scanned, autozone does this for free. Most newer cars, especially 1996 and newer vehicles will have two o2 sensors. Scanning the computer will tell which o2 sensor is bad. The primary o2 is located in the exhaust header manifold. It is visible in this picture in the bottom, slightly left of the middle. The secondary oxygen sensor will be located next to the catylitic converter. The location of the two sensors are generally the same on all vehicles. This vehicle is a 2001 2.2 liter chevy cavalier.
Here is a closer view of the o2 sensor. You will need to unplug the oxygen sensor plug which is located in the botton right corner of this picture. Pay attention to how many wires are running to the sensor. Two wire sensors are unheated and three and four wire sensors pre heat themselves for more accurate readings. The heated o2 is not generally used unless strict emissions are required by the manufacturer for vehicle start up. The two types are generally not interchangeable, so keep with the origional type. To remove the sensor simply use a wrench and unscrew it from the manifold.
Here is a replacement bosch o2 sensor. Make sure that the threads have o2 safe loctite on them or the sensor will be very difficult to remove. Also find the torque specs to correctly tighten the sensor. If bad, the o2 sensor will read incorrect amounts of oxygen in the exhaust and cause the fueling to be wrong. The car will then ignore the signal and go into a safe mode which will run rich and use extra fuel. Race vehicles will use more accurate o2 sensors called wideband o2 sensors. These sensors will need there own controller and are not interchangable with stock sensors.