The temperature of the exhaust gas as it exits the cylinder is a good indicator of the efficiency of the fuel-air mixture. As you lean the mixture from the full-rich position, the exhaust gas temperature increases - the exhaust gases get hotter - up to a point, after which they begin to cool. The hottest temperature is called peak EGT. In general, you strive to achieve a fuel-air mixture that produces an EGT 50 to 100 degrees Fahrenheit cooler than peak EGT on the rich side. This produces the optimum compromise of power, cooling, and fuel consumption. (Note, however, that under some conditions some engines can be operated at peak EGT, and some even on the lean side of peak EGT. Thus, it is vital that you read and understand the manufacturer's recommendations for leaning procedures.)
The thermometer that reads exhaust gas temperature is a sensitive probe drilled into the exhaust pipe just downstream of the cylinder head. Sophisticated systems have an EGT probe and cockpit display for each cylinder, which makes for more accurate leaning.
Because EGT probes operate in such a harsh environment - exhaust gases can reach temperatures of 1,500 degrees Fahrenheit or hotter - they wear out and either fail outright or send inaccurate readings to the cockpit gauge.
If you lean the mixture during straight-and-level constant-power flight and the engine rpm increases slightly, then drops off, or the engine begins to run rough before the needle on the EGT gauge peaks and then starts to decline, you should probably suspect that the EGT probe is faulty.
An EGT probe and the cockpit gauge it feeds can be valuable tools in helping you to operate an aircraft engine at its most powerful, fuel-efficient best under a variety of climb, cruise, and descent conditions. Just be sure the probe is up to the task, and you know how to interpret what it's telling you.