Temperature and pressure relief valves, usually called T&P valves, release water from a water heater when the temperature and pressure inside the tank become dangerously high. This usually happens when a thermostat sticks and won't shut off. People die from water heater explosions every year caused by defective (or missing) T&P valves.
First: Wrap pipe-thread sealing tape around the threads of the new valve, and tighten the valve into the heater.
Second: To test the T&P valve after installation, lift the release lever until water shoots through the overflow tube.