Why do the animals confess to being traitors in chapter 7?
Stalin's reign consisted of many purges. These were incidents in which he would kill masses of people for various reasons. They were never good ones, whether he couldn't or wouldn't get resources to people or they didn't do what he wanted them to do.
I think Orwell threw this incident into the book to demonstrate Stalin's regular purges and the effect it had on people (or in this case the animals). Once their confessions are complete and the rest of the animals are left speechless and in a huddle, we feel the weight of what has happened as readers. I think he hoped this would give the world a taste of how it felt to be a Russian under Stalin's rule.
My students in class hypothesize that maybe some of the animals knew death would be better than continuing to live this way.
A biography I've seen had Russians from Stalin's rule reporting the difficulty they experienced. They were so affected by the propaganda that they believed everything Stalin wanted them to. It is hard for us as free individuals to relate with such submission to a ruler. For them, it was business as usual.
That's a good question. Why would they confess if they are going to get killed for doing it? We aren't actually told in the book.
I assume that they confess because they have been in some way forced to do it. When Stalin (the one Napoleon is based on) did something similar to this in Russia, he had confessions that were forced by torture. He also had his secret police (the dogs) let the people know that bad things would happen to their families if they did not confess.
So I assume that's going on here -- the animals fear that they'll die in worse ways and/or bad things will happen to their families.