You collected books on the programming language or system APIs, or a textbook on algorithms, and sometimes saved magazines, plus a bit of experimentation.
Fidonet and Usenet were good places to ask.
Looking at the source code of open source projects, especially when some piece of the code was doing something that you wanted to figure out.