Ohm's Law itself is quite simple. Using it properly needs some thought.

(I): R = V/I = constant

The "constant" part is only true for 'ohmic' resistors, and an LED is definitely not among those. Actually 'ohmic' resistors are an idealization. Some resistors (materials) show 'ohmic' behaviour in certain temperature ranges (or not), in certain voltage ranges (or not). Wikipedia will tell you more about that. Have a look at kirchhoff laws, which deal with the voltages and currents in electric circuits.

Short form: a) in any closed loop in a circuit the sum of all voltages is _zero_

b) at any given point in a circuit the sum of all currents is _zero_

Going back to the LED + resistor example:

a): --> the battery voltage is split between the LED and the resistor according to (I)

If you want a certain current to flow (say 1mA) and you know the 'forward voltage' V_f of the LED (datasheet), you can calculate the resistor according to (I): R = V' / I. Mind that here V' = V_batt - V_f.

b): this states that no current can get lost. If you feed current into a junction it gets split up. If you feed it into a single 'wire' it is the same everywhere along it.

--------------

- how do I find out if I need a resistor, and its resistance?

There is no 'IF' - rule of thumb: you always need one.

- all I'm interested is battery life, will the resistor make the battery life shorter than without it?

Some energy is wasted in the resistor. P = V * I . V is the voltage drop across the resistor, not the battery voltage.

- is it possible to use "Zener" diode for the same thing? (preventing LED from burning) What is the difference?

Forget about that.

- if I another 3x such batteries, connect them again in series and the resulting packs (2 pieces) in parallel (3x + 3x), is the LED going to shine two times longer?

Yes.

- why do I need the resistor in the first place, can I just use single 1.5V battery for the same effect?

Remember R = V/I = constant. For LEDs it is not true. If you google for typical V-I graphs of LEDs, you'll find that once you've passed the forward voltage, the LED will effectively act as a short (sort of, not really). Therefore you need a resistor. If you power an "1.5V LED" with _exactly_ 1.5V it may survive (small LEDs will, high power LEDs will die too as they get hot and start to allow even more current to pass through them), go to 1.6V or 1.7V and you may kill it. The current grows exponentially with voltage, and it gets hotter and hotter. See above for the calculation of R using Ohm's Law.

- what are the factors which determine the duration the LED is going to shine? I know there are voltage and current limiters, are the prolong the life?

(II): Conservation of Engery. E = Power * time.

(III): Power = Voltage * Current.

- what I just don't get is, if a LED consumes say 1mA, will it consume from the battery just 1mA every hour, so it shines 18000 hours? Or will consume more and waste it say for heat?

For an "1.5V LED"

Power = 1mA * 1.5V = 1.5mW

If you use a 4.5V battery pack, you'll need a 3kOhm resistor as well. It consumes 3V * 1.0mA = 3.0mW and turns that into heat.

Total power consumption: 4.5V * 1.0mA = 4.5mW - the sum of LED + resistor consumption ( using b) and (III) ).

An approximation of the energy content of the battery is Capacity * Voltage. It assumes that the battery voltage stays constant, which is not quite the case, but you know that. Here it's just 18000mAh * 4.5V = 81000 mWh (current*time*voltage).

So in theory the LED should shine for 18000 hours. ( time = energy / power ).

As in reality the battery voltage drops, you won't get that of course. The resistor has been calculated to supply the LED with 1mA only if the supply voltage is 4.5V. As soon as the batteries get empty that is not the case anymore and the LED is fed with less than 1.5V, it gets dimmer and dimmer and shut off. Some energy will be left in the batteries.

The only sensible way to drain the batteries completely is by using a DC/DC voltage converter such as the mintyboost or similar circuits. Some other chips (e.g. LT1618) can be used to build a switching (energy efficient) constant current driver for LEDs that use up all of the energy in the batteries, but that gets complicated and costly. Maybe not worth for just a simple LED.

If you don't use a resistor at all, the LED will burn.

Please, say I have 4.5V battery (3x 1.5V type "D" in series battery, rated 18000 mAh each) and a LED.

I would like the LED to shine as long as possible -- what do I have to do?

Well. If you know how much current you need to get an acceptable brightness, calculate the resistor for that value.

How to get the current value? Experimentation using a potentiometer and reading the datasheet, so you don't burn it.