Just before lighting the candle on the first night of Chanukah, one recites the three Berachot of "Le'hadlik Ner," "She'asa Nissim" and "She'hecheyanu." The Shulchan Aruch (O.C. 676:1) rules that one does not begin lighting the candle until he completes the recitation of all three Berachot.
If one forgot to recite "She'hecheyanu" before lighting on the first night of Chanukah, he may recite the Beracha within a half-hour after lighting, provided that the candle still burns. If a half-hour has passed since he lit, or if the candle was extinguished, he may no longer recite "She'hecheyanu" that night, and he recites it instead when lighting the candles on the second night.
If a person forgot to recite "She'hecheyanu" on all eight nights of Chanukah, and he remembered on the eighth night a half-hour after lighting or after the candles had been extinguished, he may no longer recite the Beracha. Even though the festival of Chanukah is observed until the end of the eighth day, he may no longer recite the Beracha of "She'hecheyanu," because the Beracha pertains not to the observance of the festival, but rather specifically to the Mitzva of lighting Chanukah candles. In such a case one does not recite the Beracha even if he later lights Chanukah candles on behalf of somebody else. Since he lights for the purpose of fulfilling the other individual's obligation, and that individual had already recited "She'hecheyanu," the person who lights cannot recite "She'hecheyanu." Of course, if the individual for whom he lights had likewise neglected to recite "She'hecheyanu," then he may recite the Beracha when he lights on his behalf.
(Today's Halacha was taken from Rabbi Moshe Halevi's work Birkat Hashem, p. 112.)
Summary: On the first night of Chanukah one must add the Beracha of "She'hecheyanu" before lighting the Chanukah candle. One who forgot to recite this Beracha before lighting may recite it within a half-hour after lighting so long as the candle still burns. Otherwise, he recites the Beracha the following night. If one forgot to recite the Beracha throughout Chanukah and remembers on the eighth night after a half-hour passed since lighting the candles or after the candles were extinguished, he may no longer recite the Beracha.