Some types of trees can be tapped for useful fluids. By default, Maples and Birches can be tapped for sugary saps, and Rubber Figs and Hevea can be tapped for latex. Saps can be concentrated into syrup and used as a sweetener, while latex can be processed into rubber.
Three things are required to tap a tree: the tree itself, a tree tap, which must forged from wrought iron and placed in the middle of a trunk at least three blocks tall, and a barrel, which must be placed directly below the tap facing upward. If the conditions are right, your barrel will immediately begin to fill with sap.
Not all trees produce all of the time. Maple and Birch trees produce sap in spring at temperatures between -4°C and 6°C, or around when the snow is beginning to melt. Hevea trees produce latex only when the temperature is above 22°C. Rubber Figs produce latex at 12°C or above, but produce more slowly than Hevea. Latitude, altitude, time of the year, and the time of day all impact the temperature, and thus the flow of sap.