That's because Moses was OBEYING GOD's COMMAND to hold his arms up. God rewarded the obedience with favorable results.
When Moses lowered his arms (DISobedience), things went downhill.
MORAL: Always do what God says.
i heard a sermon today about a passage (exodus 17:8-16) in which the israelites fought the amalekites, who were a bunch of really bad people (they did child sacrifices and stuff like that) and whenever moses held up his hands (like Jesus on the cross) the israelites would be winning the battle, and whenever he lowered his hands they would be losing