What is the story behind the story about SIFT descriptor?
The descriptor obtained from a $64\times 64$ neighborhood of interest point at the obtained scale.

It will divide this $64\times 64$ region to $16\times 16$ patches which lead to 16 patches.

For each patch we calculate the gradients and then find the dominant direction of gradients(which has some details), then taking the dominant direction as the reference direction we will divide the 360 degrees to 8 angular region each has 45 degrees, then sum over the magnitude of each gradients which lie in each angular region.

We could consider this as distribution or 8 bin histogram of gradient direction (considering strong gradients has more information we have to use them with higher weight in calculation of distribution so we use their magnitude as their weight which leads to sum over their magnitude). Then we will normalize these histograms.

At the end for each patch we have an 8 bin histogram and we have 16 patches which leads to 128 number descriptor.

By finding dominant direction our descriptor also becomes rotation invariant.
By using gradients our descriptor becomes invariant regarding to baseline illumination and by normalizing obtained histograms our descriptor becomes invariant to the contrast of image.