user34816: I was testing out my new Servo FS5106B. Here is the code I used: 
#include <Servo.h>

Servo servo;
void setup()
{
    servo.attach(10); 
}

void loop()
{
    servo.write(0); 
    delay(1000); 
    servo.write(180);
    delay(1000);
}

After I upload the sketch, the console says: 

Sketch uses 2872 bytes (1%) of your device memory. Total available 253952 bytes. Global variables use 161 bytes (1%) of the dynamic memory, leaving 8031 bytes for local variables. Maximum 8192

The delay between the rotations wasn't 1 second (as I was expecting), but 13 seconds (when I connect only a LED and use the delay function, everything works perfectly). Why is that happening?
P.S The power source for the servo is my Arduino-Mega 2560, wich outputs 5V. The model I use for wiring is:  
Edit 1:
I tried to execute the program that @ChrisStratton suggested, here an updated code 
#include <Servo.h>
#define led 22

Servo servo;

void setup()
{
    Serial.begin(9600);
    while(!Serial)
        delay(10);

    Serial.println("Start!");
    pinMode(led, OUTPUT);
    servo.attach(10);
}

void loop()
{
    digitalWrite(led, HIGH);
    servo.write(0);
    delay(1000);
    digitalWrite(led, LOW);
    servo.write(180);
    delay(1000);
}

When this program loads, servo does 2 rotations in 0.4 seconds and the LED goes high and low really fast, then anything changes for another 10 seconds, then again the LED goes high and low and the Servo does 2 rotations 

user30198: In the official Arduino examples, a servo motor is powered by the 5V pin of the Arduino board. In real life, that is a bad idea.
Your FS5106B has specified about 1A stall current. The average current is less than that, but the start peak current could indeed be 1A.
Could you try to use a seperate power supply of 5V (or 6V) for the servo motor ?
To check if the Arduino resets, you could do a Serial.begin(9600); in setup, directly followed by Serial.println("the sketch has started");
Some servo motors require different timing. That would not explain the 13 seconds delay, so I assume that your servo motor has normal timing.
Do you use a breadboard ? Sending a current peak through a breadboard (with bad contacts) can cause a lot of voltage spikes.
(To the other problem solvers: I'm ignoring the 13 seconds and assume that once in a while the servo motor is able to start, just a guess, I could be wrong).
[ADDED]
@ChrisStratton is trying to tell you this:
void setup()
{
  pinMode( LED_BUILTIN, OUTPUT); 
}

void loop()
{
  digitalWrite( LED_BUILTIN, HIGH);
  delay(1000); 
  digitalWrite( LED_BUILTIN, LOW);
  delay(1000);
}

The next step would be:
#include <Servo.h>

Servo servo;

void setup()
{
  Serial.begin(9600);
  Serial.println("The sketch has started");
  pinMode( LED_BUILTIN, OUTPUT);
  servo.attach(10); 
}

void loop()
{
  servo.write(0);
  digitalWrite( LED_BUILTIN, HIGH);
  delay(1000);

  servo.write(180);
  digitalWrite( LED_BUILTIN, LOW);
  delay(1000);
}

[ADDED2]
Or even more fun, with a counter (as @ChrisStratton wrote):
#include <Servo.h>

Servo servo;

unsigned int counter;

void setup()
{
  Serial.begin(9600);
  Serial.println("The sketch has started");
  pinMode( LED_BUILTIN, OUTPUT);
  servo.attach(10); 
}

void loop()
{
  servo.write(0);
  digitalWrite( LED_BUILTIN, HIGH);
  delay(1000);

  servo.write(180);
  digitalWrite( LED_BUILTIN, LOW);
  delay(1000);

  Serial.print("Still alive after ");
  Serial.print(counter);
  Serial.println(" seconds");
  counter += 2;   // two seconds per loop iteration
}


34816: <p>I was testing out my new Servo FS5106B. Here is the code I used: </p>

<pre><code>#include &lt;Servo.h&gt;

Servo servo;
void setup()
{
    servo.attach(10); 
}

void loop()
{
    servo.write(0); 
    delay(1000); 
    servo.write(180);
    delay(1000);
}
</code></pre>

<p>After I upload the sketch, the console says: </p>

<blockquote>
  <p>Sketch uses 2872 bytes (1%) of your device memory. Total available 253952 bytes. Global variables use 161 bytes (1%) of the dynamic memory, leaving 8031 bytes for local variables. Maximum 8192</p>
</blockquote>

<p>The delay between the rotations wasn't 1 second (as I was expecting), but 13 seconds (when I connect <em>only</em> a LED and use the delay function, everything works perfectly). Why is that happening?</p>

<p>P.S The power source for the servo is my Arduino-Mega 2560, wich outputs 5V. The model I use for wiring is: <a href="https://i.stack.imgur.com/nA2rp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nA2rp.jpg" alt="enter image description here"></a> </p>

<p><em>Edit 1</em>:
I tried to execute the program that @ChrisStratton suggested, here an updated code </p>

<pre><code>#include &lt;Servo.h&gt;
#define led 22

Servo servo;

void setup()
{
    Serial.begin(9600);
    while(!Serial)
        delay(10);

    Serial.println("Start!");
    pinMode(led, OUTPUT);
    servo.attach(10);
}

void loop()
{
    digitalWrite(led, HIGH);
    servo.write(0);
    delay(1000);
    digitalWrite(led, LOW);
    servo.write(180);
    delay(1000);
}
</code></pre>

<p>When this program loads, servo does 2 rotations in 0.4 seconds and the LED goes high and low really fast, then anything changes for another 10 seconds, then again the LED goes high and low and the Servo does 2 rotations </p>
 30198: <p>In the official Arduino examples, a servo motor is powered by the 5V pin of the Arduino board. In real life, that is a bad idea.<br>
Your FS5106B has specified about 1A stall current. The average current is less than that, but the start peak current could indeed be 1A.<br>
Could you try to use a seperate power supply of 5V (or 6V) for the servo motor ?</p>

<p>To check if the Arduino resets, you could do a <code>Serial.begin(9600);</code> in setup, directly followed by <code>Serial.println("the sketch has started");</code></p>

<p>Some servo motors require different timing. That would not explain the 13 seconds delay, so I assume that your servo motor has normal timing.</p>

<p>Do you use a breadboard ? Sending a current peak through a breadboard (with bad contacts) can cause a lot of voltage spikes.</p>

<p>(<em>To the other problem solvers: I'm ignoring the 13 seconds and assume that once in a while the servo motor is able to start, just a guess, I could be wrong</em>).</p>

<p>[ADDED]<br>
@ChrisStratton is trying to tell you this:</p>

<pre><code>void setup()
{
  pinMode( LED_BUILTIN, OUTPUT); 
}

void loop()
{
  digitalWrite( LED_BUILTIN, HIGH);
  delay(1000); 
  digitalWrite( LED_BUILTIN, LOW);
  delay(1000);
}
</code></pre>

<p>The next step would be:</p>

<pre><code>#include &lt;Servo.h&gt;

Servo servo;

void setup()
{
  Serial.begin(9600);
  Serial.println("The sketch has started");
  pinMode( LED_BUILTIN, OUTPUT);
  servo.attach(10); 
}

void loop()
{
  servo.write(0);
  digitalWrite( LED_BUILTIN, HIGH);
  delay(1000);

  servo.write(180);
  digitalWrite( LED_BUILTIN, LOW);
  delay(1000);
}
</code></pre>

<p>[ADDED2]<br>
Or even more fun, with a counter (as @ChrisStratton wrote):</p>

<pre><code>#include &lt;Servo.h&gt;

Servo servo;

unsigned int counter;

void setup()
{
  Serial.begin(9600);
  Serial.println("The sketch has started");
  pinMode( LED_BUILTIN, OUTPUT);
  servo.attach(10); 
}

void loop()
{
  servo.write(0);
  digitalWrite( LED_BUILTIN, HIGH);
  delay(1000);

  servo.write(180);
  digitalWrite( LED_BUILTIN, LOW);
  delay(1000);

  Serial.print("Still alive after ");
  Serial.print(counter);
  Serial.println(" seconds");
  counter += 2;   // two seconds per loop iteration
}
</code></pre>
