Typically, you will arrive in Terespol by international train that continues into Belarus. Otherwise there is a shuttle train between Terespol and Brest a few times a day. Often is quicker to go by bus (that stops close to, but not next to the railway station). The bus is usually crowded by Belarussians who went shopping in Poland, so the border formalities take ages. So if there is a shuttle train soon, take it!