MPLS provides mechanisms for traffic engineering by allowing routers to forward packets based on fixed-length labels rather than long variable length IP addresses. MPLS labels are assigned to packets at ingress routers and swapped or removed by transit and egress routers along the Label Switched Path (LSP). Routers can be configured with constraints and administrative groups to calculate optimal LSP paths using protocols like RSVP and LDP.