Basically what I know is that 8086 can address up to 1 MB of locations which are divided in 4 segments(code, data, extra and stack) 64 KB each. But 64 KB * 4 is 256 KB, which doesn't add up to 1 MB(1024 KB). So what about the rest of space.
The four segments you mentioned are not static - these are in fact registers that can point to any 64kb zone in the 1MB memory. By changing the value of these registers we can point to other fragments of the memory.
The exact computation of the effective address is performed using 2 registers: a segment register (CS,DS,SS,ES) and an offset register (usually BX, SI, DI, BP). Each one of those registers is 16bit.
To get the 20bit effective address,
the CPU performs
EA = SEGMENT_REG * 10h + OFFSET_REG (mod 20bits).
It is easy to see that by changing the SEGMENT_REG/OFFSET_REG (0000h-FFFFh), the above equation allows one to span the entire 1MB memory address space (00000h-FFFFFh).