How do I get 5V for a Raspberry Pi from 4 D batteries?
The Raspberry Pi FAQ states:


  Can I run power Raspberry Pi from batteries as well as from a wall socket?
  Yes. The device should run off 4 x AA rechargeable cells, but there may be stability issues as the batteries lose their charge.  Using 4 x AA Alkaline cells will result in 6v and it is therefore recommended to use a voltage regulator.


As your batteries clearly exceed 6 Volts at least when new, use a voltage regulator to drop the voltage just for the RPi down to 5 Volts, to stay within the 4.75 to 5.25 Volts recommended by the manufacturer.

Due to the very low voltage headroom available for regulation, a 7805 regulator will not serve the purpose. Instead, use a Low Drop-Out regulator, such as the ST Microelectronics L4940V5, which is designed to deliver 5 Volts from even a 5.5 Volt source.

As pointed out by @Ignacio in the comments, when adding a voltage regulator to the power path, one must incorporate not just the voltage regulator itself, but also any additional support components as suggested in the regulator's datasheet. For 3-terminal regulators this would typically be a moderately large value (usually 10 to 100 uF) electrolytic capacitor between input and ground as a reservoir capacitor on the input side, and typically a somewhat smaller value capacitor (1 to 10 uF are commonly seen) between Vout and ground on the output side of the regulator. 



For the servo itself, if you have the option, select a servo for which detailed datasheet information is available. RC servos I have encountered have been rated for 6 Volts nominal, 4.5 to 7.5 Volt supply range, but that does not guarantee that this particular servo supports those specifications. 

Assuming you get an RC servo that supports the 6.5 Volt supply upper limit (most commonly available ones seem to), simply connect the servo's supply and ground lines directly to the battery + and - terminals, in parallel with the voltage regulator you will be using for the RPi. In other words, do not use a voltage regulator for the supply to the servo.

Adding a moderately large value capacitor (10uF, perhaps) between the supply pins of the servo, in parallel with a reverse-biased diode, would help reduce EMI generated by the motor traveling back to the battery and thence to the RPi.

Since both the RPi and the servo will be supplied from the same battery without any isolation between them, mentioning that the grounds of the RPi and the servo must be connected together, is redundant in this case. If the servo were to be supplied from a separate battery altogether, shorting the grounds would be something to ensure.