Water moves into stem xylem cells through a chemical process that occurs when salts and sugars interact in the root xylem. The salts and sugars are then transferred through osmosis to the stem xylem of the trees. According to Michigan State University, water molecules are pulled into xylem cells during this process when they attach to moving salt ions. Once water enters the cells of the stem xylem, it's like water entering the bottom of a straw.
Water moves toward where water is being removed. At the top of a tall tree, leaf surfaces lose tremendous volumes of water through evaporation. When water enters the atmosphere from the surface of the leaf, it creates tension in the xylem, all the way back through the stem, twigs, branches, trunk and roots. It works much the same way that sucking on the end of a straw pulls liquid from the bottom of a glass to your lips.