I remember I wasn't too impressed with this episode the first time I saw it in it's first run. Maybe now that I'm older I can appreciate the subtle messages here, including how one deals with loss. We learn that even Data, who is not capable of great emotion, deals with grief in his own way.
The episode is "The Offspring," written by Rene Echevarria and directed by (the first episode directed by) Jonathan Frakes.
After attending a cybernetics conference, Data has embarked on a secretive lab experiment. He finally reveals it to staff members Troi, Geordi, and Wesley. He reveals his new creation--an android named "Lal."
In the beginning, Lal is unfinished--an androgynous android whom Data will allow to choose its own gender and species.
Lal decides on human female and after her transformation, begins the learning process. In the meantime, Captain Picard is not too pleased. He wants to know from Data why he was not consulted on this first. Data's argument is if humans are not made to consult the captain whenever they create new life, why should he be made to?
Data gets to work schooling Lal in human behavior basics such as talking, blinking, and even drinking.
Starfleet command gets wind of this new Data-like prodigy and an admiral Haftel comes aboard ship to take Lal to a facility where he feels Lal can best be served. When Lal is interviewed by the admiral, she insists she wants to stay with her "father" aboard the Enterprise.
Then the unexpected happens. She feels afraid and confused and goes to the lab where she was programmed to do in case of malfunction.
The admiral observes as Data works to repair her circuity that is melting down in a cascade failure. He works hard to no avail.
The admiral comes out of the lab and informs the crew that Data worked fast and hard to repair Lal but the damage was too extensive and she wouldn't last long. The admiral is on the verge of crying while saying this, showing him to be not the cold hearted human as he first appeared.
This part actually had me in tears on the second watching. They say good-bye. Data, unable to say and mean "I love you," Lal says she will feel it for both of them.
Date reports for bridge duty and informs the crew that he has downloaded Lal's positronic memory in his so she will live on within him.
Today, I can appreciate this as a beautiful story about love and loss, and of course, the question of who should determine who has human and parental rights.