You must collect all of the coins and mushrooms floating around each level. Only then will you be able to leave. If you miss any of them, you will not be able to exit the level and will have to go back. Take your time and think carefully. Some of the coins and mushrooms will require a bit of problem solving to obtain. There are 10 levels.