What happens if you leave a ninja star behind? Can you go back and get it? Seeing you head towards the door without your third star gave me a little panic attack at first.
The star stays where you left it -- unless it was stuck in the ceiling, in which case it may be below where you left it. When you die and respawn at a savepoint the strays are removed from the world and returned to you.
Some care has to be taken when throwing them to assure you'll be able to get them back without having to die first. They act predictably when they bounce off something, so you should always have a good idea of where they will end up.