Why does Satan do what he does when he know he will lose? Is it just that he wants to get as many brothers and sisters to be as unhappy as him?
I would like to start this answer by asking you a question. Why do you or any of us sin when we know we only will be losing out and hurting ourselves? Yet we sin more often than we should ever like to.
Now the scriptures tell us a bit about Satan’s mindset. In Moses 4:6 we learn:
6 And Satan put it into the heart of the serpent, (for he had drawn away many after him,) and he sought also to beguile Eve, for he knew not the mind of God, wherefore he sought to destroy the world.
And in 2 Nephi 2:18 we read:
18 And because he had fallen from heaven, and had become miserable forever, he sought also the misery of all mankind.
From these two verses we learn that Satan does not know the mind of God and is trying to make us all miserable like himself.
So to your question does Satan know he is going to fail? I would think so. The bigger question is has he accepted that answer? Or is he, like many of us when caught up in sin, doing his best to deny it while trying to figure out a way to get what he wants without repentance?
I could easily see that being the reason, but the idea that he knows he is going to lose and he is seeking to take as many with him as possible also seems a solid reason for what he is doing. However, in the end Satan is in the hands of God just like we are, and he will be dealt with according to the justice and mercy that God has for all of us.