Simple.
Prussia wanted the full of Saxony and the return of his polish territories.
Russia, in exchange for keeping those Polish lands, supported Prussia in gaining Saxony and whatever compensation they wanted.
GB was happy enough to give land to Prussia (At one point they considered the idea of a Prussian lead North German federation because they thought that that way they could be sure that Germany would be in good, british allied, hands) but they were afraid of Russia becoming too powerful so their position was mixed. On one side they thought it was better for them to have a powerful Prussia (At the time a very very very weak naval power and so they weren't a threat to GB) to counter France but they didn't want a more powerful Russia.
France was against the annexation of Saxony so they went against Prussia-Russia.
Austria, afraid of the developments, sided with France in refusing the Prussian demands.
As a compromise Prussia gained most of Saxony (40%), kept Posen, gained Danzing and Westphalia. The last one was because no one other than France and Austria were willing to see France keep "it's natural borders". The natural border was considered the Rhine but GB wasn't willing to accept France on both banks of the Rhine, the Russian Emperor thought the French king an idiot and wasn't willing to have France become a threat again and so they gave that land to the only country they thought they could trust Prussia. GB couldn't give those lands to Hannover (the others would oppose) and it was too much of a threat to leave those lands divided again so Prussia gained it in compensation for most of it's polish territories.
This of course included other negotiations.
Russia gained poland and was allowed to keep finland (sweden gained Norway in return) but they couldn't add those lands into the Russians Empire (personal union was what the congress demanded).
The southern netherlands (Belgium) were joined with the Netherlands and in exchange for losing nassau (to prussia) they won Luxembourg.
Swedish Pomerania was passed to Denmark that in turned gave it to Prussia in exchange for Saxe-Lauenburg.
Hannover gained Munster and East Frisia (formerly Prussian land) in exchange Lauenburg went to Denmark.
Austria regained their lands, gained northern italy and Tarnopol in exchange they lost southern netherlands.
As you can see this was a huge confusion.
If you want to read more about this I remember a biography of Metternich that had some very important parts on the Congress and the why's of things (the author was French and had a clear bias against Russia and Prussia but the book was good overall).