user26237: I noticed something when I was trying something with leds;
  pinMode(13,HIGH); // giving +5V to pin 13.
  delay(1000);      // waiting for 1 sec.
  pinMode(13,HIGH); // giving +5V to pin 13 again.
  delay(1000);      // waiting for 1 sec again.

  //loops forever.

But I couldn't light the led. What is the reason behind this? Shouldn't it be lit forever?

user19867: As already in the comments, you are using pinMode(...) where you should be using digitalWrite(...)
The code should look like
void setup() {
  pinMode(13, OUTPUT); // sets the pin to an OUTPUT, it can now source or sink current
}

void loop() {
  digitalWrite(13, HIGH); // sets the pin to +5V
  delay(1000); // waits 1 sec
  digitalWrite(13, HIGH);
  delay(1000);
}

When you use pinMode(13, LOW) you are actually writing pinMode(13, INPUT) as LOW and INPUT are two aliases for the same value (0, by the way).
When in INPUT mode the PIN doesn't source or sink any considerable current, so I can't say much more about why the LED is turning on unless you provide a schematics of your circuit (but I have idea you are doing something really wrong).
It might be useful to have a look at this simulation: 

on the left the LED is connected directly to voltage source without control from Arduino
in the middle, the LED is controlled by Arduino on the high side: click on the letter to toggle the pin state
on the right the LED is controlled on the low side


26237: <p>I noticed something when I was trying something with leds;</p>

<pre><code>  pinMode(13,HIGH); // giving +5V to pin 13.
  delay(1000);      // waiting for 1 sec.
  pinMode(13,HIGH); // giving +5V to pin 13 again.
  delay(1000);      // waiting for 1 sec again.

  //loops forever.
</code></pre>

<p>But I couldn't light the led. What is the reason behind this? Shouldn't it be lit forever?</p>
 19867: <p>As already in the comments, you are using <code>pinMode(...)</code> where you should be using <code>digitalWrite(...)</code></p>

<p>The code should look like</p>

<pre><code>void setup() {
  pinMode(13, OUTPUT); // sets the pin to an OUTPUT, it can now source or sink current
}

void loop() {
  digitalWrite(13, HIGH); // sets the pin to +5V
  delay(1000); // waits 1 sec
  digitalWrite(13, HIGH);
  delay(1000);
}
</code></pre>

<p>When you use <code>pinMode(13, LOW)</code> you are actually writing <code>pinMode(13, INPUT)</code> as <code>LOW</code> and <code>INPUT</code> are two aliases for the same value (0, by the way).
When in <code>INPUT</code> mode the PIN doesn't source or sink any considerable current, so I can't say much more about why the LED is turning on unless you provide a schematics of your circuit (but I have idea you are doing something really wrong).</p>

<p>It might be useful to have a look at <a href="http://www.falstad.com/circuit/circuitjs.html?cct=$%201%200.000005%2010.200277308269968%2050%205%2050%0AR%20224%20112%20176%20112%200%200%2040%205%200%200%200.5%0Ag%20224%20240%20224%20304%200%0A162%20224%20112%20224%20176%201%202.1024259%201%200%200%0Ar%20224%20176%20224%20240%200%20220%0Ar%20368%20176%20368%20240%200%20220%0A162%20368%20112%20368%20176%201%202.1024259%201%200%200%0Ag%20368%20240%20368%20304%200%0AL%20368%20112%20320%20112%200%200%20false%205%200%0AL%20512%20240%20464%20240%200%201%20false%205%200%0A162%20512%20112%20512%20176%201%202.1024259%201%200%200%0Ar%20512%20176%20512%20240%200%20220%0AR%20512%20112%20464%20112%200%200%2040%205%200%200%200.5%0A" rel="nofollow">this simulation</a>: </p>

<ul>
<li>on the left the LED is connected directly to voltage source without control from Arduino</li>
<li>in the middle, the LED is controlled by Arduino on the high side: click on the letter to toggle the pin state</li>
<li>on the right the LED is controlled on the low side</li>
</ul>
