If the train has a toilet then there will usually be a sign in your carriage pointing you in the direction of the nearest one. Don't assume there will always be a toilet though. Short distance commuter trains don't always have them, they tend to only be on longer distance trains.