Multipoint Taylor formulas and applications to the finite element method