In the early days of the hobby, most steam engines picked up current from one side of the rail, while the tender picked up current from the opposite rail. The tender transmitted its current to the motor in the locomotive by way of a current conducting bar connection.
Subsequently more power pick-ups were added to the locomotive itself, and in some cases both sides could be picked up by the loco itself...so loco could run without a tender connected.
Nowadays most steam engines come with circuit boards onboard that distribute power to the motor as well as the lighting, and usually have a receptacle into which a decoder can be plugged to obtain DCC control. You have to be careful trying to switch tenders around with these engines, as some of them are purposely wired in different manners between various loco types to avoid electrical mismatches. You need to google these and look for forum discussions as to their compatibilities.