Seven-Segment Display doesn't work on two lights
As jwpat7 states, you need a current-limiting resistor for each segment, between the data pin (on the Arduino) and the segment pin (on the display). Your Fritzing diagram only shows one resistor in the circuit, from the common cathode to GND on the Arduino. 

You can not, or should not, share one resistor to ground (assuming that you have a common cathode seven segment display). You need a current-limiting resistor on each anode (again, (assuming that you have a common cathode seven segment display).

If you are sharing the current-limiting resistor between all segments, and then try to light more than more segment, at a time (which it sounds like you are doing ("when I plug the red cable to 4 and 5"), then the current through the current-limiting resistor will increase, and as a result, the voltage will change significantly enough, such that there is not sufficient voltage drop across the LED in order to make it light up. 

Remember, 0.7&nbsp;V is dropped across the LED.

Test each on the segments, one at a time, to make sure they all work, as Ignacio states in his comment.

Also, your sketch should be more complete, along the lines of:

void setup() {
    pinMode(2, OUTPUT);
    pinMode(3, OUTPUT);
    pinMode(4, OUTPUT);
    pinMode(5, OUTPUT);
    pinMode(6, OUTPUT);
    pinMode(7, OUTPUT);
    pinMode(8, OUTPUT);
}

void loop() {
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH);
    digitalWrite(6, HIGH);
    digitalWrite(7, HIGH);
    digitalWrite(8, HIGH);
}


Connect up all of the pins, using a current-limiting resistor on each anode, and then try it programmatically.

If your seven segment display is a common anode, then, again, you need a resistor between each cathode and the data pins, and bring the pins LOW to light the corresponding segment, i.e.

    digitalWrite(8, LOW);