I am a self proclaimed expert on this matter, purely because drinking 4 litres of water a day (every day, not just when I am long rides) means I use the loo a lot!
After you have ridden a certain route a few times, you quickly learn where public toilets are located. Service stations also used to be a good option, but these days less and less seem to have toilets attached. You are always guaranteed of a toilet at McDonalds, but whether you want to leave your bike out the front while you pop in is another question. As a male, I do have the 'go anywhere' option, but I have only resorted to this option twice. The first was on the road around the back of the airport - then one that heads towards the control tower. No toilets in sight. The second was only a few weeks ago, when I went to go to the toilets at Brighton Beach. It was about 6am and they were locked. When you have to go, you HAVE to go!