Power spliter for Raspberry pi and servo motor
@mguima has provided a useful link in his answer. BUT do note Chris Stratton's comments also.
Important considerations include:

Any motor tends to make electrical &quot;noise&quot; which a microcontroller is very sensitive to.

Usually the power needs of a motor exceed that which what can sensibly be fed from a Pi header directly.

The servo voltage needs to be correct and may not match the Pi supply.


Overall, when starting off, supplying the servo from a separate supply, batteries or other is a safe move.
Grounds of Pi supply and servo supply MUST be connected.
The servo control lead can usually be driven directly by the Pi.