Could I buy a direct train from R to S on the day of travel, or is it recommended to book in advance....
Yes, you can, but ticket bought more than 15 days before has 15% discount. More than 7 days before too, but the discount will be lower.
From Rzeszów to Szczecin is the longest possible direct route between two big cities (capitals of województwo) in Poland :)
I would recommend one of those direct trains. If this won't be in the first days of winter school holidays in Poland (20th January, when the holidays begin for students from województwos: lubelskie /Lublin/, łódzkie /£ódź/, podkarpackie /Rzeszów/, pomorskie /Gdańsk/ and śląskie /Katowice/), there shouldn't be problems with seats, but I recommend to book tickets in advance to ensure that you won't have to stand.
P.S. You go from Rzeszów to Szczecin, so even in the first days of holidays there shouldn't be problems with seats. Then the trains in an opposite direction will be busy, people will want to go to southern Poland where there are mountains.