There are several reasons why this behavior is being exhibited in your dog.
For instance, if your dog is walking in circles before he pees, this is because dogs have a great sense of direction and magnetic fields and they prefer to go to the bathroom facing the north-south axis and will line themselves up to do so.