I've been asking myself this question for a long time, and it seems that Maximilian was just not a strong enough leader to both defeat Juarez's liberal forces and satisfy the conservative Mexicans who were supposed to support him. Maximilian was entirely too moderate for his base's liking, as
@scholar already pointed out. Really, I think if you want a successful Second Mexican Empire, you will need Napoleon I of France to hand-pick someone else to be the Emperor of Mexico, someone who is both conservative enough for the dominant Mexican political ideology and willing to essentially act as Napoleon's puppet. If the conservatives are more willing to support the emperor as someone who represents their interests instead of just as someone who isn't Juarez, I think you have a shot at a successful Second Mexican Empire, at least for a couple decades.