LEDs connected in series, parallel, and series-parallel combination
Different color LEDs have different turn on voltages:


(Image credit: softsolder.com)

Therefore, in your first circuit, only the red LED will light brightly, and the others will be very dim if they light up visibly at all.

In your second circuit, the light will also be nonuniform, because with the same series resistor, you'll have different currents through the three different colored LEDs, but at least they're all likely to light up visibly.


  how do the resistor or resistors limiting the current?


As you can see in the chart above, if you apply a voltage above the turn-on voltage to an LED, the current can increase very quickly. If you applied 6 V directly across any of these LEDs, you'd likely blow them up.

With the series resistor added, part of the voltage can be dropped across the resistor, and the voltage across the LED is limited to something close to the turn-on voltage. The current through the LED ends up being very close to 
$$I = \frac{V_s - V_f}{R}$$
where \$V_s\$ is the source voltage, \$V_f\$ is the forward voltage of the LED, and \$R\$ is the value of the series resistor.