A united Germany simply outmatched France in terms of population, industry, and war-making capacity.
Post-1871, how could France rival Germany?
Boosting the population via immigration and gaining more access to vital industrial materials would be another. Late 19th century France did get quite a bit of immigration IIRC. How could France get even more migration?
The country would need more coal and iron. Perhaps finding a way to more tightly link Spain to France could help in this regard (and help with the population issue).