Transistors do lots of analog tricks, but we only use them to switch high powered stuff with a weak microcontroller pin. Usually an LED. See the IR Toy, #twatch, PICqueno, or USB POV Toy for the sad truth.
We’ve standardized on the BC818 for most stuff. It’s cheap, always in stock, and it handles a decent load from a small SOT-23 package. The BC81840 has more gain, so it’s our go-to for prototypes, but either part is usually fine.
If you’re choosing a substitute part be sure to check the pinout. The BC818 is “BEC”, pin 1 = base, pin 2 = emitter, pin 3 = collector. This a common package, but there are different parts lurking out there to foul you up. Datasheets always list the pinout differently, so we made this diagram as a quick reference.
Verify your schematic and footprints too. Eagle has every combination of transistor pinout. In our Eagle part library the BEC package is marked with a big note so we don’t repeat past mistakes. Just remember Boys Eat Cheese and you’ll be fine.
For a bigger load, or a continuous load where an SOT-23 package gets hot, we’d go for something similar in SOT-223.
This is meant as a summary of what we use, not an essay on transistors. Please fill in the gaps and share your experience in the comments.