Some good answers above.
Wolf is right, when saying that "locals" do the industrial switching, spotting or pulling loads and empties from the shippers and consignees. These cars are usually gathered up and taken to classification yards, where they will become a part of a train consist heading to its destination.
But, more and more, locals will line-up the cars in their train outside of a terminal, "blocking" them according to destination. Then, a thru freight will pick these cars up in block, and they will move from there to destination without the delay in the classification yards.
Trains are also stopped for other reasons, including some given above, such as clearing the main track into a siding to let another train to pass or to be met. This is usually on single track main line.
But, trains can be held for maintenance of way work, held out of a yard account no room, the crew has expired on the Hours of Service, the train has mechanical or electrical problems, held for a "non-clearing" train (one that is too long for any sidings on the district) as well as other operating needs that may arise.