I am trying to find a way to find the resistive and reactive part of an impedence.
Also I would like to know how such setup woks.
So the signal is analog and of frequency range less than few KiloHertz.
Ok, so let's first recall the principle of extracting the phase shift by frequency mixing. Say you apply a voltage current I=I0 cos(wt) to your impedance Z=X+iY, the voltage on Z will be V=I0*|Z|*cos(wt+phi). (you also have tan(phi)=Y/X)
If you multiply the V signal by a reference signal cos(wt) you get cos(wt+phi)*cos(wt)=1/2(cos(2wt)+cos(phi)) and after a lowpass filtering you get a DC voltage proportional to cos(phi) (principle of "synchronous detection"). So basically you multiply the current by the voltage. To measure the current and voltage at the same time just put a shunt resistance in series with the unknown impedance Z you measure, the voltage on the resistance is proportional to the current.
For practical implementation you can feed the R-Z series impedance via a transformer and set the ground in the middle point between R and Z. If you don't have a transformer use two opamps configured as voltage subtractors (differential amps).
In RF we use double balanced mixers for multiplication but you won't find DBMs for such low frequencies.
For frequencies below a few MHz you can find active analog multipliers like the AD633 (it has differential inputs so you won't need any additional voltage subtracting circuit). Note also that your reference signal does not need to be sinusoidal, it can be (and in fact is the most often) a square wave, as you can easily show applying the calculations above to the Fourier series expansion of a square wave. Multiplication by a square wave is much easier: just periodically changing the sign of the input signal, if you want a purely analog circuit (no microcontroller) it is easy to assemble such a "DBM" with a comparator, inverter and a DPST analog switch (I did it once in a similar low-frequency application, the "home made" mixer circuit was chosen mainly for pedagogical reasons but it worked very well). This also has the big advantage that the output is independent of the amplitude of the reference signal.
Now there is a little problem with measuring small phase shifts because cos(phi) will be very close to 1 and not varying much. This is why we usually use two mixing circuits with two reference signals in quadrature, so that you get cos(phi) and sin(phi) at the same time*. Another benefit of quadrature detection is that the determination of the phase angle will not depend anymore on any signal/reference amplitudes nor on the value of the shunt resistance. For low frequencies it can be done easily with a microcontroller and is maybe a bit more difficult with a purely analog circuit, I have seen two types of circuits: 1) a two D flip-flop circuit to generate two square-wave reference from a 2f input, then a lowpass to get the sinusoidal excitation signal; 2) using an R-C network and two comparators to detect zero-crossing of the R and C voltages (then no need for a lowpass).
* This also allows to determine the sign of phi, not possible with cos(phi) alone.