The chemical reactions and pathways resulting in the formation of TRAIL (TNF-related apoptosis inducing ligand). TRAIL induces apoptosis in a wide variety of cells and is a member of the tumor necrosis factor (TNF) family of cytokines.