As everyone's saying, write it all down. Also, the dungeoncraft column in Dragon is great for this kind of stuff. You should be able to find the web version of the Dragon site.
On a more detailed level, this is what I do:
1) Go out and buy the biggest, thickest note-book you can find. Carry it with you always. This is your idea's book. Anything, and I mean anything, you think of that's game related gets written here. New character concept? Put it in. New Spell? Put it in. Encounter idea? Put it in. You don't necessarily have to do this in detail, but include as much information as you can off that first idea. Mine has all of the above, plus more - Potential names, new products I've seen on the shelves that i want to imitate or buy, bits of descriptiong I just have to use, even ideas for new campaigns and game systesm. After a few weeks of note taking, you'll end up with a big storehouse of ideas. The big advantage of this is that they're all in one place - whenever you need to track down an idea you know where to look.
A lot of proffesional writers do this to store and generate ideas. Even if you only use half the information in your ideas book, it's comforting to know that they're there.
Another good idea is to use this notebook to flesh out ideas. Ideas are like rabbits - put two together and they'll start to breed.
This is probably one of the few places where I have problems with dungeoncract. It recommends never creating more than you need. I believe in the opposite. i always create more than I need - if I don't use it now, I'll get to use it later. I always work of the theory that this campaing that I'm writing isn't the only campaign I'll ever write, so more ideas are things I constantly strive for.
2) Buy another big notebook. This keeps all your campaign notes and scribble stuff. Write down what happens in your game. Make notes of what monsters the Pc's encounter. Take down the hastliy thought up names of NPC's you created when the PC's went into the inn. Work out the NPC's they'll encounter between sessions here. Work out where they're travelling and make a few notes here. More often than not, I have the first notebook open any time I'm working in this one. Even in the act of creating a new NPC, there are at least three or four new ideas that come up and should be grabbed, even if it's just differnt ways the stats could be arranged for the same NPC.
3) Type up advanture notes.
Most of my campaign stuff will only ever be relevant for one adventure. The New NPC's are mostly dead after that, and some settings get show up once and never get returned too.
If something needs to be fleshed out for an adventure, I do it. I put in as much information as necessary and save it with the adventure notes.
4) Campaign folder
I'm not usually the person who decides what goes in my campaign folder. Usually, the big sign that this needs to be done is when something gets used a lot - the same NPC crops up again and again, the party keeps going back to the same place, or someone shows a sign of interest in a particular prestige class (or I keep using them for bad guys).
Once this happens, I'll usually cut and paste the basic information out of the adventure it started in and add a bit more too it, flesh it out until it starts to feel a bit plump. It's worth keeping in mind that most campaign settings of size (namely the realms and other whole world stuff) don't give you a huge amount of location on their settings straight up, you usually have to buy more supplements to get more detail. This isn't so much because they want to make money - it's because each campaign will focus in on different elements. Fleshing out waterdeep isn't going to do you a lot of good if your entire campaign is set in the Dales. Flesh out only what your campaign focuses on. Leave your notes in your notebook, you can always track them down if you need them later.
I try to keep things grouped together - Prestige Classes usually start out with race notes and locations attached in my adventure notes, and odds are if the PrC is showing up again the rest will as well.
Print everything necessary and put it in a folder. After a while, it starts to grow naturally. You end up with nations where there was once a small town. If you ever need something and you've lost your adventure notes, odds are it still exists in one of the notebooks, so you can always track it down.
Well, that's more incoherent detail than I originally intended to go to. Sorry for the long read, and i hope its useful.