I understand that the capacitor produces a resistance proportional to the 50 Hz of the mains input current, in this case 220 volts
But why is that resistance installed in parallel, what function does the resistance have?
This is transformerless power supply. Capacitor restrict current flowing. Resistor for discharging capacitor then main power is off for safety purpose. Also the circuit not complete. If main power on in peak of sinusoid, discharged capacitor make short circuit, current limited only by ESR of capacitor. Resistor in series should be added.