You usually need at least two Lionel CTC lockons, but most Lionel O and O27 train sets came with a single CTC lockon connector.
If your train slows down as it gets farther away from the transformer, that’s the biggest tell-tale sign that you need at least one more lockon.
Ideally, you’ll want a lockon every four or five pieces of track. The more times you’ve disassembled the track, the more likely you are to need that many. The problem is that the electricity loses voltage each time it has to traverse the pins in the track, and the looser the connection, the more the voltage drops. Adding more lockons is usually the easiest way to compensate for the drop.
When you wire your lockons, be sure to be consistent in the way you wire them. Using two different colors for the two connectors on the lockon is the easiest way. If you mix the wires, you’ll create a short and the train won’t run, and you risk damaging your transformer.
I realize I’ve talked so far about Lionel, but the same principle applies for American Flyer and Marx as well. Marx trains are completely compatible with Lionel lockons; American Flyer S gauge trains have their own lockons.
Lionel CTC lockons aren’t too hard to procure on Ebay or from Trainz. Trainz usually will be cheaper as long as they have stock. Trainz also stocks American Flyer lockons, and a universal lockon that works with either O/O27 or S gauge track.
If you want to save money, you can solder your wires directly to the underside of your track. This gives you a bit better, more electrically sound connection. It also costs less, as long as you already have a soldering iron and some solder. Another trick to avoid soldering is to attach spade lugs to the wires and push them into the underside of the track, like I did.
To reduce the number of track connections you need to make, you can get long straight sections, which are about three feet long. Be sure to get the right kind, O31 or O27, and I explain the difference here. And here are more tips for connecting your Lionel transformer if you need them.