Most scale model toy trains have a smoke unit, if smoking is appropriate for the particular type of locomotive. Those units require either pellets that heat over the locomotive headlight bulb, or liquid that heats within the smoke unit. It is not recommended to convert a non-smoking locomotive to smoke, since heating fluid in a locomotive that may be made from inappropriate materials could be a fire hazard. And you certainly wouldn't want to see a diesel engine running down the track with smoke pouring from under it.
Remove the body cover from the locomotive, exposing the smoke unit beneath the smokestack. Clean the reservoir for the pellet or fluid. With a screwdriver or knife, scrape out any old pellet or smoke fluid residue.
Fill the reservoir with a small amount of fibreglass, if your locomotive is an old Lionel and you are converting from pellets to fluid. This conversion is recommended, since the pellets haven't been manufactured for 40 years, and they've become scarce and expensive.
Return the locomotive body to its chassis.
Place a few drops of smoke fluid down the smokestack into the fibreglass. Run the train. In the old Lionels, the headlamp bulb will heat the fluid and create smoke. Some more modern smoke units may have a mechanism to make smoke puffs.
Don't expect great volumes of smoke. Toy train smoke units emit a thin bit at best. Smoke units can also be used for chimneys of buildings in your track layout.
Avoid the temptation to substitute other, cheaper materials for smoke fluid. Using substances such as lamp oil or WD40 is a fire hazard. Don't attempt to use fluid in a smoke unit that requires pellets without first putting in the absorbent, non-flammable material. Nor should you put pellets into a fluid-burning unit.