This is taken from a nursery rhyme of the time Orwell was growing up ("The Chestnut Tree" by Glen Miller 1939), much like he took the line "oranges and lemons say the bells of St. Clements." The references to these cultural cornerstones of the time are meant to stress that in Winston's world, no one remembers the true versions anymore; they have been tainted by the "falsification of the past" so that no one can learn from history to see what the future holds.
The original lyrics are as follows: "Underneath the spreading chestnut tree/ I loved him and he loved me/ There I used to sit up on his knee/ ´Neath the spreading chestnut tree." The change of the lyrics is slight, but quite meaningful. Love is not permitted by party members. Instead, they are encouraged to turn in anyone suspect of any crime against Big Brother, thus they end up selling each other out (as Winston does later with Julia and as Rutherford, Aaronson, and Jones have done as mentioned in Part I, ch. 7) thus switching the word "loved" to "sold."
The second change is in the word "lie" as we find out that Winston once held evidence to prove that the confessions of these three men were lies (Part I, ch. 7) and the confessions Julia and Winston make are lies as well.
The quote references the fact that Winston sells Julia out during the torture to save himself. The Party succeeds in breaking up Winston and Julia, who were once a couple, and both now work for the Party and spend all their energy honoring and loving Big Brother.
When Winston is taken by O'Brien and tortured, he manages to keep himself from betraying Julia, the woman he had a relationship with in the book. The goal of the torture is to break the subject's will and convert him into accepting the philosophy of Big Brother.
Winston has a tremendous fear of rats, so when the torture escalates to the use of rats, Winston begs for them to stop torturing him and torture Julia instead. Winston's spirit is broken and he returns to working for the Party.
He works for the Party and often goes to the Chestnut Tree Café where he runs into Julia. Winston and Julia were once lovers, now when they meet it is as if they are strangers. They have both been brought back into line and use all their energy for the party.
It means several things. Start with the most basic: the song is used by the Party to entertain the masses and keep them quiet. Then move up the scale to foreshadowing: the Chestnut Tree Café is a place where rebels meet. However, if you sell someone there, the meeting will be false. Winston and Julia meet like lovers under trees, but they eventually reach a place where they sell one another. The song therefore becomes ironic.
He has lost all his individualism and no longer is skeptical or questioning about the events given to him regarding Oceania. He no longer recognises Julia as the woman he loved and both are now strangers. They become loyal solely to the Party and their love and devotion is for the Party only.
At end of the book, Winston and Julia meet again, but refuse to rekindle their relationship due to successful brainwashing. Winston tells her "I betrayed you" and she replies the same thing back to him. Winston is shown earlier forced to face rats, his greatest fear, by O'Brien in Room 101, sparing himself only by screaming "Do it to Julia!" This last meeting between Winston and Julia implies she said something similar. The Chestnut Tree refers to the cafe that the story finishes in, where Winston finally celebrates party propaganda claiming Oceanian victory over a Eurasian military offensive. This final scene depicts that Winston has been brainwashed successfully enough to do whateverthe party tells him to do and block out his common sense and skepticisim.