The term ‘cliffhanger’ to mean a plot device involving a main character in a precarious dilemma is thought to have come into popular use from the end-of-episode situation in adventure silent films of the early 1900s, where the protagonist was often literally left hanging from the edge of a cliff.
It may have originated with Thomas Hardy’s serial novel A Pair Of Blue Eyes in 1873. At the time newspapers published novels in a serial format with one chapter appearing every month. To ensure continued interest in the story, at one point Hardy chose to leave one of the main protagonists, Henry Knight, hanging off a cliff staring into the stony eyes of a trilobite embedded in the rock. This became the archetypal cliff-hanger of Victorian prose.