The ending of Shrek 2 means that Fiona and Shrek choose each other as ogres, and the film treats that choice as the real happily ever after. At midnight Fiona turns down the chance to stay human and picks Shrek as he really is. Both return to ogre form, and Donkey changes back as well, much to his disappointment.
Why does the potion matter? The Happily Ever After potion offers the storybook version of the ending: a handsome husband and a beautiful bride. Opinion: the film is at its sharpest when Fiona punches Prince Charming at the ball instead of falling for the kiss, because that one swing rejects the ideal the whole ball has been staging. Charming works as a picture of the fairy tale ideal rather than a true rival, which is why Shrek walking away, believing Fiona may be better off without him, is the real danger in the story, not the swordplay.
The reveal about Harold adds a second layer. He swapped the poisoned drink meant for Fiona, then stepped in front of the spell aimed at Shrek. He is the Frog Prince who used the same potion years earlier to win Queen Lillian, so his own happy ending was bought with the same shortcut. The spell bounces back and destroys Fairy Godmother, Harold turns back into a frog, and the film closes with its villain gone and no kingdom saved, only a family repaired.
The production backs up how much weight these faces carry. Computer Graphics World reported in May 2004 that the facial animation system was rewritten for higher resolution models, with a simplified version of its muscle system applied to whole bodies. Prince Charming's head alone was built with 92,644 hairs, and Puss in Boots had the most complex rig of the main characters, able to switch between a four footed and a biped setup with his hat built into it. In my reading, that investment is why a quiet beat like Fiona's refusal at midnight can rest on expression alone.
Against the rest of the series, the structure is distinctive. Shrek 2 begins where Shrek (2001) ended, with the wedding already done, so its question is whether the marriage survives pressure from outside rather than how it begins. Puss in Boots, hired to get rid of Shrek and then switching sides, is the one new arrival who stays on, and he later headlined his own films. The ball ends in celebration, and the final scene hints at more stories to come for the characters. That leads into Shrek the Third. For the full run, the Shrek movies in order page sets out the release and chronological order.