A servo uses a potentiometer attached to the output shaft in order to sense position, and the internal electronics take care of driving the motor to move the shaft to the desired angle.
Usually, when you want a servo motor, you simply buy one already made. But if you need something unusual, you can turn any DC motor into a custom servo you can control just like [Dejan] did.
The Festo CMMT-ST starter kit offers a host of learning curve benefits and costs 50% less than individual parts.