The types were designated by configurations of their wheels. For example, a 2-8-4 engine had two small guide wheels in front, eight giant drive train wheels middle, and four small support wheels under the cab where engineer and fireman operated the locomotive.
I learned all of this, of course, while researching for my book, GRIT, co-authored by William Maltese. If you read the excerpt which accompanies the book on its publisher's web site, MLR PRESS, you will see that one particular type of engine, a 2-10-2, had some issues when first put into service. The incident is fiction, but the problem and solution was very real.
I found one of these locomotives on display at a museum and snapped a picture of its drive train wheels.
Lo and behold, my character in GRIT, Wilton Zukel, was assigned this same type of steam locomotive when he became engineer pulling drag freight for the Santa Fe Railroad. Unlike his father's 2-10-2, Wilton's machine served faithfully and flawlessly until 1933. This is the only known photo of Wilton with his 1677, one year before "the mishap" that takes place in our story.
He's on the left near the cab, doing a walk-around inspection before boarding for departure. The accident which occurred on an Edgerton, KS siding would end the 1677's career, but Wilton survived to continue his service with the Santa Fe and fuel his romance with a certain railroad detective.
It's all documented in our Great Depression-era, fact-meets-fiction, manlove novel, GRIT, and it's available in paperback and ebook formats at MLR PRESS.