These decoders are made to fit specific locomtoive chassis. Locomotives that have circuit boards that can have decoders installed in place of the original circuit board are made by many manufacturers.
In some cases, locomotive modifications, motor isolation and additional soldering may be required during installation of this type of decoder. Function leads can be added to these decoders using solder pads available on the decoder.
See the instruction sheet for the particular decoder you are using for specific instructions.
Sometimes these are called plug n' play or drop in decoders.