how to identify transistor/IC by its model/product number?
Do a web search for "[part number] datasheet".  For example, searching for "2N3904 datasheet" should lead you to datasheets for a 2N3904 transistor.

The transistor and diode part numbers appear to just be randomly assigned numbers, with no inherent meaning.