How do you know that Satan knows he will lose? The Bible says that Satan will lose in the end, but it doesn't say that he knows this. Perhaps Satan does not believe that the Bible is true on this point, and he thinks that he can win. After all, in pretty much every human war, both sides enter the war predicting that they will win. It seems unlikely that Satan would have rebelled to begin with if he knew in advance that he was doomed to lose.
Here is a totally fanciful scenario, but one that I think is plausible: In the beginning, God creates the universe and people and the angels. At some point in there he creates Satan. So he creates him and he tells him, "I just created you." But at some point Satan starts to say to himself, "How do I know that God created me? Just because he said so? Maybe I and all the other angels, AND God, evolved by random processes. Maybe we all just sprang into existence by chance, in some kind of Big Bang. God happened to be the first to evolve. Then he ran around as other angels came into existence and told them that he created them, and we all just believed him. Maybe he's no more powerful than any of us, or just a little more powerful, and if a bunch of us got together, we could overthrow him and we could be in charge."
As I say, it's total fiction that I just made up. But something LIKE that scenario would be consistent with the Bible and what we see in the world around us.