Sometimes I'll talk to the dogs I encounter. It kind of depends on the situation. Like suggested above...I don't want to cause the dog to become a burden to the owner...so if the dog seems agitated I won't say anything.
There is one dog that I frequently encounter at the beginning/ending of my rides just over a mile from my house. It's a little Boston Terrier. Cute, but nothing really to be frightened of. It gets PI$$ED off when I ride past its yard (which I assume is protected with an Invisible Fence since the dog doesn't leave the yard). At my approach it comes sprinting out from the porch, barking its everloving head off, and then runs parallel to me down the length of the yard, barking, as if to chase me away, and to protect its domain. I can only assume this dog feels very confident...since its barking always sends this much larger beast, on a machine with wheels, away and never makes a closer approach.
Dan