1)
Why does it say that he fought "Im Livnah", regarding Lachish "Bah", and regarding other cities "Aleha" (verses 31, 34)?
1.
Malbim: Fighting Im implies that both sides fight. Yehoshua pursued the five kings and did not intend to fight Livnah. However, Anshei Livnah came to meet him when he passed, so both sides fought each other. Regarding Lachish, he entered the city and fought Bah (in it). Regarding the others it says Aleha, for they were walled cities; he fought against them to seize the fortress.