You can use a solution of citric acid and some espresso machine manufacturers will sell this specifically, you can use general purpose descaler, for which there should be instructions on how much to dilute it by.
Talking from experience it depends on how hard the water is where you live and you should really do it every month if it is a hard water area.
I also found that I need to remove the fine filter where the coffee is pumped out to remove the gasket seal and clean all of the above, I was lazy and neglected my Gaggia for about 6 months and after a couple years the solenoid pump died.
The less hassle method would be to use bottled soft mineral water. For instance I have started to only use this with my kettle and there is no limescale build up since switching 1 1/2 months ago, whilst before, using Brita filtered water would start to show limescale after a week and I'd need to descale after 3 weeks.
These are the instructions on my descaling solution for a coffee machine:
Add 100ml of solution to 500ml of water and add to water reservoir,
turn on and run through the machine. Then run 2 full reservoirs of
water before using again.
I remember with citric acid you had to pump it through and then leave for 30 minutes and then fully flush a few times.
Here is a youtube video from Gaggia about performing this: https://www.youtube.com/watch?v=4SPkjWJzUJQ
The key thing here is that if you don't do it then limescale starts to form on the metal filter and gasket seals which will affect the flow rate. This isn't the worst bit though, like with any heating system that uses hard water, the hard limescale will inhibit the heating and pumping performance which can lead to a complete pump failure which is what happened to my machine, I recommend using citric acid (which is a weak acid and safe to consume in diluted form) and/or bottled mineral water.