Collect 50 rings, then touch a checkpoint star post. Sparkles appear around it — jump into them to enter the special stage.
Inside, you are given a target number of rings to collect. Reach that number and you are awarded a Chaos Emerald; fall short or run out of rings and you are ejected empty-handed. Repeat across the stages until you have all seven.