Throughout the film, Amy Adams constantly dreams about her daughter. But at the end of the film you find out that the opening montage of her daughter's death, and the dreams she has about her, actually take place after the events of the film, not before. By learning the alien race's language, she also developed the ability to experience memories of events yet to occur. And the "dreams" she's been having all along about her daughter are actually premonitions and memories from the future - she learns that she'll fall in love with Jeremy Renner's character, have a daughter with him, and that Jeremy Renner will divorce her when she eventually tells him that she knew their daughter was going to die but went though with the pregnancy anyway. Around the same time, Amy Adams has a premonition of a future United Nations conference where the world's political leaders are celebrating humanity's unity with the alien race. There, she meets the Chinese president, who whispers something in her ear. Back in the present, she stops the breakout of war against the aliens by calling the Chinese president herself and reciting what he'll later whisper to her: his wife's dying words, which only he knows until he tells her in the future. It's such a tough ending to pull off and it works spectacularly.