Modern engine management system need a way to monitor the amount of fuel that is injected into the engine, so by putting a lambda sensor in the exhaust system to monitor the oxygen content that is present in the exhaust gasses.
Lambda sensors work by sensing the amount of O2 in the exhaust gases and converting this to a readable voltage for the engine control unit (ECU) to convert into more or less fuel that is injected into the engine. the correct amount is known as lambda 1 or 14.75:1 fuel ratio, this is also called stoichiometric. the O2 sensor try's to keep the O2 in the exhaust gases between 0.97 to 1.03 lambda.
Most lambda / oxygen sensors that is used on cars today have four wires to them but there is sensors with one two or three wires as well.
The sensor will not start to work until it heats up to about 300 degrees. With the three and four wire sensor, this has its own heater built in that speeds up its operation and allows it to be placed further away form the exhaust manifold. Once up to temperature and sensing exhaust gasses it generates its own voltage as the oxygen content of the exhaust gases change.