At the end of Battle Day, the winner is the clan with the most stars
scored against the enemy. In the case that both clans score the same
amount of stars, the winning clan is the clan that has dealt the
higher amount of total destruction. Should both clans deal the same
amount of stars and total destruction, the war will be considered a
draw. This, however can be considered rare, as total destruction dealt
is different in each attack and hardly sync with the enemy clan.
so if you get more stars than them you win. if you cannot get more stars, and you have the same amount as them, your best bet is to try and get more damage on a base in order to get a higher total damage. However, you need to have your attack be the new best attack for your total damage % to go up. Getting higher destruction % on a base, but less stars will not increase the total damage %. This is a trend I have noticed over several wars.