why add a resistor parallel to voltage source?
You might change your mind if you unplugged the device and then touch the plug pins.

The 1 MΩ resistor between live and neutral provides a discharge path for the capacitor. The discharge time constant is given by $$ \tau = RC = 1M \cdot 10n = 10^6 \cdot 10^{-8} = 10^{-2} = 0.01~s $$. This is nice and fast and should prevent the user getting a surprise.