Why attach sensor output to ground?
R1, R2 and R3 form a voltage divider.



simulate this circuit &ndash; Schematic created using CircuitLab
When a 5V signal is applied to the top of the divider (the echo signal), ohm's law states that:
$$\frac{5V}{3000\Omega} = 1.67 mA$$
Will flow trough the resistors to ground. This means there will be a voltage drop of:
$$1.67mA * 1000\Omega = 1.67V $$
Across each resistor.
Since R1 and R3 are in series, their voltage drops add up. So there will be approximately 3.34V on the output to the raspberry pi.
The raspberry pi input has a very high input resistance so that it's effect on loading the divider can safely be ignored in this case.