It's a fairly simple machine. The line-holding spool is stationary and points in direction of the cast. When you cast, the lure or weight pulls the line off the end of the spool. So the real issue becomes: how do you retrieve the lure and get the line back on the spool? Answer: the bail. This is that wire-like loop of metal that is attached to the "rotor" that surrounds the spool. Before the cast, the angler holds the line in place with their index finger and "opens" the bail manually with the other hand and it clicks into the open position, which means it can't catch the line flowing off the front end of the spool. When the cast is over and the lure has landed at its target on the water, the angler either 1) flips the bail back over with their non-casting hand, or more likely 2) begins to wind the handle which will automatically release a catch on the rotor that was holding the bail open. The bail closes and, since it is attached to the rotor housing, "orbits" the spool as the reel handle is cranked. The line is caught by the bail and moved into the crook of the bail wire (which usually has a roller so as not to wear out the line with friction) and each rotation of this bail rotor assembly lays a wrap of line around the spool. This is how the lure/line is retrieved. Note that when i mentioned above that the spool is stationary during all this I wasn't being completely accurate: there is a cross-cut worm gear in the main body of the reel that causes the line spool to which it is attached to oscillate forward and backward as the handle is cranked. This is important because otherwise the line would bunch up on a small area of the spool.
This seems very complicated, as though a "conventional or "casting" reel with a spool that rotates would be a simpler machine, but I can tell you from experience that the opposite is true. I can pretty much disassemble and rebuild most spinning reels without referring to any manuals; but the one time i tried to do that with a bass casting reel i was left with an embarrassing pile of various parts including tiny springs and bushings that wound up serving no purpose other than as a cautionary tale. (I had to buy another reels is what I'm saying...😬)