Practise, practise, practise.
How do you remember how to walk? How do you remember how to speak? Granted these skills aren't exactly the same and they don't require a, seemingly, encyclopaedic knowledge (for beginners, at least), but you're using the same thing: memory.
While I admit that, for beginners, programming can seem an impossibly large subject when you start to study it, it becomes like any other subject once you've gotten the basics down.
As soon as I figured that out, I started to break things down into smaller and smaller chunks (my own, personal version of abstraction). That way, something that seemed difficult to remember becomes easier (at least with me it does).
Writing things down helps more than you might think (having worked in Education, I know that this can have massive positive effects on retention). Especially if you can put it into your own words - rather than just copying it verbatim. If you can paraphrase or equate it to something you already know, even better.
In C#, String objects are immutable. This means that whenever I tell my program to change the contents of a string object, what actually happens is the original string is destroyed (technically it's placed on the garbage collector's lowest level). Exactly like when an artist makes a mistake when creating a marble sculpture - it cannot be changed, thus it is destroyed and a new one created.
It's not a great example, but it shows the basics of what I'm getting at.
Quality documentation helps, too. Something that my Programming 101 lecturer once told me stuck with me:
Make your commenting verbose. Not to the point of stupidity, but you need to be able to write comments that a non-programmer could understand. That way, you know that someone else on the project can understand it, perfectly. Imagine that you'd spend months implementing a system but you where involved in some kind of horrible accident on the way to work. Someone else will be assigned your work - especially if it's close to crunch time - and if they can't figure out what your code is doing, then production stops.
Good books are an excellent resource, too. A different tutor once told me that if a book doesn't have an index (and there are lots of them, out there that don't), then it's not worth buying.
Google can be an amazing resource, but be aware of copy-paste coders. Stay away from sites that just give you a block of code with no explanation. I prefer to read a whole article on small blocks of code, that way you go away knowing exactly what the block of code is meant to do, how it does it, and why the programmer wrote it that way.
Hope that helps