This is the Tehachapi Loop at Tehachapi, California.
Amtrak’s Coast Starlight occasionally does a re-route through here if there is track work being done on their normal route.
Typically though this route is freight only. Union Pacific and Burlington Northern Santa Fe Railway both run their freight trains through this route. The Santa Fe originally owned the trackage, and when BN and SF merged in 1995, that ownership, naturally, continued. Union Pacific has trackage rights through Tehachapi Pass.
The loop is used to help gain elevation in order to climb the steep gradients and hills more easily. Without the smaller loop seen here, it would be much more difficult to try and traverse this pass with a long freight train.