You first have to construct the node group. Start creating nodes, then shift-select them and add them to a group.
You’ll then have group with the nodes you selected above - plus group inputs and group outputs. Remember that you are using this node group to iterate a pattern or an aspect of the material - therefor you shouldn’t put all your material nodes into the group - only the parts you want to iterate.
One of the group inputs must be named “iterator” (note all lower case).
You also need at least one other input and a matching output. These must be the same type (e.g. value, colour etc) and must be named identically. You must also ensure that you don’t have any conflicts (i.e. dont have two group inputs or outputs named the same)
What you can then do is connect the “iterator” input via maths operations into the slot of a texture, shader etc - and essentially drive the value through an iteration.
For example - on the first iteration - the “iterator” input has a value of 1. If you run this through a math node set to multiply by 10 - your result for that iteration is 10.
For the second iteration - the “iterator” has a value of 2 - so going through the same math node now results in a value of 20.
If you were to run this math node into say the scale slot of a texture - the scale with each iteration would change and make the texture smaller with each iteration. Similarly if you ran the math node into say the “detail” slot of a texture - the texture would get more detailed with each iteration.
The crucial part now involves the matching input and output. To get the loop to work as intended - you need to pass the input value - then mix it with the texture - before finally passing to the matching output.
What this does is for each iteration it takes the value of the output of the group and loops it back to the input. So for example if you used an colour mix set to overlay what would happen is this:
Iteration 1 - pattern generated by the taxture - passed to the output node.
Iteration 2 - output from iteration 1 used as input for iteration 2 and overlayed with the pattern generated from iteration 2
Iteration 3 - output from iteration 2 used as input for iteration 2 and overlayed with the pattern generated from iteration 3
etc
As you can see - if the pattern differes between iterations due to a difference in scale, detail etc - you quickly build up a far mnore complex pattern.
Once you are happy with your grouped node setup - close it by hitting tab, then add the “loop” node from the cycles shader/texture menu (it’ll appear under “custom nodes”).
Once you have added the node - you need to use the drop down list within it to select the name of your node group above.
If everything is ok - you should now find that your loop node now has the same inputs and outputs as the group you created above.
Connect the group output (e.g. colour) into the colour slot of a shader (e.g. diffuse) and then connect the diffuse to the material output as normal. Render and you should now see a pattern.
If for any reason you don’t see a pattern - go back into your group and play around with the maths. Because the textures tend to output values between 0 and 1 - multiplying these together iteratively, can quickly lead to a flat grey or black (e.g. multiplying pixel values of 0.1 * 0.3 * 0.2 * 0.1 = 0.0006).