Was Darth Vader told by someone in the Empire's army or did Darth Vader learn some other way that Luke Skywalker is his son?
In the original screenplay for Star Wars: The Empire Strikes Back (1980), the whole idea of Vader as being Luke's father was not present, only the idea that Vader might convert him. Here is the original script:
During filming the idea of making Vader Luke's father emerged and the script was changed to the following:
VADER: There is no escape. Don't make me destroy you. Luke, you do not yet realize your importance. You can end this destructive conflict and bring order to the galaxy.
LUKE: I'll never join you!
VADER: If you only knew the power of the dark side. Obi Wan never told you what happened to your father.
LUKE: He told me enough! He told me you killed him.
VADER: No. I am your father.
LUKE: No. That's not true. That's impossible.
VADER: Search your feelings. You know it to be true.
LUKE: NOOO! NOOO!
VADER: Luke, you can destroy the emperor. He has foreseen this. It is your destiny. Join me and together we can rule the galaxy as father and son. Come with me. It is the only way.
[Luke jumps into the void.]
The actual point Vader learns of the parentage is when he is on Star Destroyer chasing the Millennium Falcon in the asteroid field and the Emperor makes a communication to him. The language of this exchange was altered during filming to suggest this. First the original script:
As it was filmed for the 1980 initial release of the film:
VADER: What is thy bidding, my master?
EMPEROR: There is a great disturbance in the Force.
VADER: I have felt it.
EMPEROR: We have a new enemy - Luke Skywalker.
VADER: Yes, my master.
EMPEROR: He could destroy us.
VADER: He’s just a boy. Obi-Wan can no longer help him.
EMPEROR: The Force is strong with him. The son of Skywalker must not become a Jedi.
VADER: If he could be turned, he would become a powerful ally.
EMPEROR: Yes. Yes. He would be a great asset. Can it be done?
VADER: He will join us or die, my master.
As it was rewritten again for the 2004 DVD re-release:
EMPEROR: We have a new enemy, the young rebel who destroyed the Deathstar. I have no doubt this boy is the offspring of Anakin Skywalker.
VADER: How is that possible?
EMPEROR: Search your feelings, Lord Vader. You will know it to be true. He could destroy us.
VADER: He is just a boy.
Since Vader of course knows that he himself is Anakin Skywalker, he realizes that the emperor is telling him that the "young rebel" is his son.
According to the current canon, as derived from the comic Star Wars: Darth Vader 6: Vader, Part VI, Darth Vader learns that the X-wing pilot is his son when Boba Fett can only provide the name of the pilot who destroyed the Death Star.
This is after Vader has been punished for failing to protect the Death Star, so in his embarrassment, he enlisted Boba Fett to track down the individual culprit, so he could be given a painful death. Fett failed to catch Luke, but he got a hold of his name. Vader became furious when he heard that Luke was alive, as Palpatine had inferred that his offspring died when he "killed" Padmé. Thus, Vader became feverishly obsessed with getting a hold of his son, for both uniting with him and turning him to the dark side.