Why do Super Mushrooms sometimes appear at the end of Super Mario World levels?
Super Mushrooms (and other power-ups) will appear if Mario crosses the Giant Gate with a non-enemy object in his hands. Where as Enemies will turn into coins/1-ups.
There are a few stages though where hidden power-ups will emerge from the ground as you walk/run past a hidden trigger. Yoshi Island 1 has an example of this as you past by a standard bush only to have a Mushroom pop-out from behind it. Likewise, there's some levels where Mushrooms are hidden on the ground to collect as you pass though the Gate. It'll always appear in the same locations in the same stages, so there's no prerequisite for them to appear.