Duality in structured and federated optimization : theory and applications