If the load is a real 50 ohms, then how the real parts are matched
without the absence of resistance in the matching network?
Quite simply but, it's all in the math and not obvious when looking at an L-pad for in stance: -

The picture above comes from my basic website and, it offers a calculator that allows you to pick values for L and C that match a 50 Ω source to a 300 Ω load. Of course, because there is a calculator you can choose to match whatever resistance value you want to which ever load resistance you want. That's up to you.
But, I also provide a derivation of the values for L and C: -

So, if you are interested in how the input impedance of a network formed by L, C and a load resistance looks like a resistor then take a look. For a simple L-pad it's this: -

How does a PI or L network matches impedance even though it does not
have a real component?
For a Pi-network, break it into two back-to-back L-pads as shown on my basic website: -

The IC has a real (resistive) part of 39 ohms and an imaginary
(reactive) part of 6 ohms.
That's easily solved; if the reactance is capacitive then use a series inductor of the same reactance to cancel it out. Then you are left with a resistive output impedance at the operating frequency you are concerned with. You can do the same with loads that are reactive and this is what people do.