Electrically speaking, there’s no reason a Lionel train has to run in a circular loop. A circular loop is the simplest way to set one up. But if you want another shape, you can do it.
Why people run Lionel trains in loops
The main reason people run Lionel trains in loops is simplicity. If the train runs in a loop, it doesn’t have to turn around. But that’s not the way trains run in real life, so some people want something other than a loop.
Alternatives to loops
One trick people will do is disguise the loop. You can make the track in a U shape with a dumbbell-like turn at each end, but long straightaways in between running parallel to each other. That’s the simplest way to get something that doesn’t look like a big oval. It can also save space, by letting you run the train on a shelf around the perimeter of the room, rather than a huge table that takes up the center of a room.
Lionel trains also let you do a trick with switches, where you put a circle of track behind the two converging lines on a switch. You can set up two switches this way, with a straightaway connecting the two. When the train enters the switch, it turns around, then exits through the switch in the other direction. A layout set up this way is also called a double reverse layout. This gives a layout more visual interest since the train changes direction every second time it traverses the track.
The example above uses Fastrack, but you can use any type of track, as long as you can get an automatic, non-derailing type switch for it. Lionel Fastrack switches work, as do the postwar O22 switches for O-31 track. For O27, I’ve had best results with Marx 1590 switches.