Divide and conquer. For any task that will take more than X units of time it is possible to divide it into smaller tasks. Identify them. Rinse, lather, repeat.
Obviously, X units of times varies depending on the overall size of the problem and the experience of the developer.
edit: Sample problem taught after some programming 101 lessons: Count the number of 'a' letters in any given word.
At first all newbies get stuck on that new problem. They probably have done some problems involving loops, maybe even traversing a word. Or probably not. But they need to figure out some things:
- that they will need a counter variable to store the final number of 'a's
- and to increment that variable when they found an 'a'
- so they need to check letter by letter if it's an 'a' or not
- beginning at the beginning of the word
- and checking every letter until the end of it (or maybe the traverse the word backwards, but that would be odd for a newbie)
Of course, they won't find all of the subtasks at first, but they should be able to found a few. They may start working on them ("hmmm I think I need an int counter = 0;..."), and continue thinking and eventually they get closer to the end and finally complete their task.
If someone can't find any subtask to begin working on, they will not ever be a programmer (or at least a successful one).
And with more experience, you are more used to that way of thinking and can solve bigger things easily. At the end, it's just a matter of learning gradually and gaining experience.