To try to do something so difficult that it will probably end in failure.
To continue to wage war when it is clear that one is not going to win.
To go on a wild-goose chase; to persistently engage in a futile activity.
To attack imaginary enemies.