Animal Farm is a political satire on the Soviet Union under Stalin. The Animalist revolution, like the Bolshevik insurrection in Russia in October 1917, was supposed to lead to the emancipation of the poor and downtrodden. In both cases, however, it lead instead to dictatorship, terror, and mass repression.
Old Major, who's clearly based on Lenin, advocates the liberation of animals from their oppression at the hands of their human exploiters. It's an intoxicating message, one that resonates with the farm animals. When the time is right, the animals rise up and throw off their shackles, chasing the farmer Mr. Jones (based on Tsar Nicholas II of Russia) from the farm.
When Old Major dies, there is a brutal power struggle between the two most charismatic pigs: Napoleon and Snowball. This alludes to the power struggle that broke out between Stalin and Trotsky after the death of Lenin. Napoleon, who's based on Stalin, prevails in this epic battle of wills and drives Snowball (Trotsky) from the farm.
Once he's secure in his power, Napoleon, like Stalin, unleashes a campaign of terror against his opponents, many of whom confess to imaginary crimes at show trials, just like Stalin's opponents in the Communist Party of the Soviet Union.
As well as being brutal, Napoleon also proves himself to be incompetent, presiding over a massive deterioration in the animals' standard of living. This parallels what happened in the Soviet Union under Stalin, when millions of people died of starvation while the regime shipped grain abroad to pay for its program of rapid industrialization.
Napoleon's regime further betrays the cause of the Animalist revolution by doing business with the hated human oppressor. It is this that leads to the famous last line of the story, which tells us that it's impossible to tell the difference between the pigs who run the farm and the humans with whom they do business.
This is another allusion to what happened in Stalin's Russia, where the regime did business with the capitalist powers in order to build up the Soviet Union's industrial capacity. A regime that was supposed to establish a worker's paradise ended up creating a system where those in charge were no different from the exploiters they had replaced.