Servo motor not working properly

I noticed that my servo motor was not working properly, so I decided to test it out using the sweep example from the Arduino IDE. It is not spinning all the way and it is making some clicky noises. Can someone please tell me how I can fix this?

(video of the servo)

"spinning"?
A servo does not "spin"

Please describe your problem

The clicking may be the servo hitting an end stop and the gears skipping or the motor stalling. NOT good. Not all servos will go from 0 to 180 degrees. It is best to test the servo to determine the actual range of motion on the servo.

Don't try to power the servo from the Arduino 5V output. Use 4xAA instead, and connect the grounds.

Nice video. The servo does move forward and back.
Not sure if you mean the fact that it is not moving at constant speed.

Anyway: you have to post the demo code you used in the video and the code that you wrote yourself.

You should post code by using code-tags

just three steps

  1. press Ctrl-T for autoformatting your code
  2. do a rightclick with the mouse and choose "copy for forum"
  3. paste clipboard into write-window of a posting

Servos should always be powered by an EXTRA Power-supply.
Servos pull too much current for the Arduino-onboard voltage-regulator.

Of course you can find tutorials and videos where the servo is powered through the arduino but this is near the limit and if you have a servo that pulls a little more current than the one shown your voltage-regulator will shutdown or burn through.
best regards Stefan

Actually that does look like there's a tight spot in the servo - it seems to slow down always at the same point.

Its a hobby servo, not a servomotor... Anyway its always sticking in the same place so I suspect a defective device (these are cheap mass produced items, not precision engineered!).

If your power source is inadequate it may be making things worse - never use the Arduino 5V to power a servo, they demand more current than it is safe to supply. Budget at least 1A for the tiny servos, and more for larger ones.