The most common reason for a coolant temperature gauge not working is a problem with the coolant temperature sensor. Signs of a bad sensor include black smoke in the exhaust, a car using more gas than usual or a car overheating frequently. The check engine light also comes on when there is a problem with the coolant temperature sensor.
The location of the coolant temperature sensor depends on the make and model of the car. However, most sensors are located in or near the thermostat of the cooling system, so it's wise to check the manual of the car to see if there are one or two sensors.
The coolant temperature sensor measures the resistance to the coolant and sends this information to the engine's control unit. The measurements are then relayed to the coolant temperature gauge. It is normal for a gauge to show a very low temperature when a car is first started, but after approximately 20 minutes, the needle of the gauge should rest at the midpoint.
Before replacing the coolant temperature sensor, check to make sure that none of the wires leading to and from the sensor are frayed or cut. Also, look behind the gauge to make sure it is properly wired.