I would highly recommend first watching the following video for an introduction to the algorithm by Prof. Fred Hamprecht:
The algorithm is based on the idea that every image has similar regions. I.e in the following image regions q1 and q2 are similar to region p.
If we take similar regions and average them, then we'll get a denoised version of that region. In the image above regions q1 and q2 are very similar to region p, however region q3 is very different, therefore regions q1 and q2 will have a higher weight, and region q3 will have a lower weight.
The denoised version of p can be described by the following simple formula:
[indent=1]p = V(q1)*W(q1) + V(q2)*W(q2) + V(q3)*W(q3)...
V() is the grayscale value of a central pixel of a certain region, and W() is the weight of the whole region (higher weight = more similar to the original region). The weight W() will depend on the similarity between corresponding pixels in the original and searched region as well as the distance between the original and search regions.
Example: Let's say that e is the original pixel that we want to denoise, a-i is the region around that pixel:
[indent=1]1 2 3[color=#fff0f5]_____[/color]a b c