The LM317 is really an op-amp, a voltage reference and a large Darlington pair transistor. The 0V of the op-amp is connected to the regulator's output, which is why it needs a certain minimum load current to work properly: without it, the op-amp won't have enough power. The inverting input is connected to the output and the non-inverting input to the adjust pin via a 1.25V band gap voltage reference, which is biased by a 50µA current source connected to the input pin. The tiny 50µA bias current can be ignored for most applications, because it's small, compared to the current flow in the resistors.

The op-amp adjusts its output voltage to alter the current flowing through the Dartington pair, to try to keep the voltages at both of its inputs the same. Because, the voltage reference holds the voltage on the non-inverting input at 1.25V above the voltage on the adjust pin, causing the op-amp to set the output to 1.25V above the adjust pin, forcing the adjust pin to different voltages will also change the output, which will sit at 1.25V above the adjust pin. For example, if the adjust pin is tied to 0V, the output will be 1.25V, if it's tied to 1V, it will output 2.25V.
In an ordinary LM317 circuit, there are two resistors: R1 and R2. Because R1 is across the output and adjust pins and the LM317 keeps the voltage across it at 1.25V, the current through R1 will also be constant, because it has a fixed voltage across it. One off the applications of the LM317 is a constant current source, which relies on this fact: the circuit can be found using a search engine. R2 is also in series with R1, so any current flowing through R1, also flows through R2. Suppose R1 is 125Ohms, the current through it will be equal to V
REF/R = 1.25/125 = 10mA. If R2 = 125R, the voltage across it will also be 1.25V and the output voltage will be 1.25 higher, giving a total output voltage of 2.5V, if R2 = 500R, then the voltage across it = 500*0.01 = 5, so the voltage on the output will be 5+1.25 = 6.25V.
The formulae are listed below.
V
REF = 1.25V
I
R1 = R1/V
REF = R1/1.25
I
R2 = I
R1V
R2 = R2*I
R2V
OUT = V
R1+V
R2Put the above equations together and the formula for the calculating the ouptut voltage in the standard LM317 circuit can be derived.

Now we need to look at how the other circuit converts the PWM signal to 0V to 1.5V, then later we'll examine how the two circuits fit together.
A potential divider can be modelled as a voltage source, with a series resistance equal to both of the resistors connected in parallel.

V
IN = 5V
R1 = 5k6
R2 = 2k4
V
OUT = V
IN*R2/(R1+R2) = 5*2.4/(5.6+2.4) = 1.5V
R
OUT = (R1*R2)/(R1+R2) = (5.6k*2.4k)/(5.6k+2.4k) = 1.68k
Putting this back into the other circuit, assuming the PWM duty cycle is 0% so zero volts.

The output voltage, can be calculated using the standard LM317 formula:
V
OUT = 1.25*(1+1680/1200) = 3V
When the PWM is at 100% of 5V, the potential divider will appear as 1.5V, again in series with 1.5V, so the output voltage simply increases by 1.5V to 4.5V

I hope you can see that the PWM is still filtered by the capacitor, but the R in the circuit is now 1k68, rather than 1k, so now the potential divider works like a 1k68 resistor in series with a variable 0 to 1.5V voltage source, connected to the adjust pin of the LM317.