Your servo motor operates off 5V, but if you try to drive it directly from the 5V pin on the Arduino, it will take so much current that the Arduino will stop working, or will behave erratically.
So, take the power from the battery directly. You can get this from the Vin pin on the Arduino. This avoids sucking power from the Arduino's 5V pin. Then use a voltage regulator to reduce the voltage from Vin to 5V, and use this to supply your servo motor.
The Arduino shield you have been given, has provision for you to do this.
Servo motors work by being supplied with a stream of pulses.
The position the motor goes to depends on the length of the pulses you are sending. You have to send a new pulse every 20 milliseconds. If you stop sending pulses the motor goes limp. It is quite a nuisance having to send these pulses all the time your robot is doing other jobs, so there is a servo library to manage this for you. It is already installed in the Arduino IDE.
Open the Arduino software and go File- Examples and scroll down until you find Servo. In there you will find two examples: Sweep and Knob. Sweep is the more useful, although you will not want to just sweep the motor back and forth. You will want to send it to the open position or the closed position. This is much simpler than sweeping and just involves one command:
myservo.write(pos)
Note that the motor has a a range of 180 degrees. It will not turn through a full revolution, and generally, this is not necessary.
pos stands for position and can be a number from 0 to 180. Once you send the servo to a position, it will forcefully stay there. In other words, it will not drop what it is holding.
Below shows how the wires from the servo motor are colour coded. On our black servos the yellow or PWM wire is white.
The servo pins on your shield are in the right order. You just have to make sure you put the plug on the right way round.
The servo motor has a couple of stops which prevent it from moving through a range greater than 180 degrees.
Please make sure that you do not try to send it past these stops. It will damage the motor.
You can hear if it is straining at the stop. Turn it off and change the position command to reduce how far the motor goes in that direction.
If that does not give you the position you want, remove the servo horn, rotate it a little and put it back on again. Repeat, if necessary until you get the range of motion that you need.