As far as I can tell, an ultrasonic rangefinder works by reflecting inaudible soundwaves off of objects and timing their return. But if the object has a flat surface and is angled with respect to the line to the rangefinder, how does it detect that object? Under what circumstances might it give a false distance or otherwise fail to detect the object?
The sound beam is not traveling in a straight line but is leaving the range finder is a multi-lobed pattern.
Of course we are interested in the main lobe. When the sound wave hits an object, it is reflected in various directions. So some of that energy returns to the sensor and triggers it, therefore measuring the distance. Reflection depends on the material and the shape of the object as well as the angle with respect to the centerline of the range finder. As you pointed out, if this angle is large enough the reported distance will be off, as shown in the following figure
Both figures are from the paper "M. Drumheller - Mobile robot localization using sonar (1987)"