Rooks should be on open files, or at least on files likely to open.
Where to play the rook?

Read "Pawn Power in Chess" by Hans Kmoch, and you will never again have to ask where your Rook should go. He's got good tips on where to post Knights, too.

So in my opinion I would move my rook to an open file or a semi~open file and create a rook battery and force open the file and then create "Pigs on The Seventh ";But if the position is closed then I would save the rooks for the endgame.
I was analyzing one of my games recently and I moved my rook, but the analysis said I should have moved it to another square.
I've looked through the lessons, but I can't find anything about how to play the rooks.
First, is there a lesson on chess.com that talks about the best way to move the rooks?
Second, is it better to move the rook to a file where the pawn is being captured or the file that is becoming open by a pawn trade?