Earned RUN Average does exactly what it says on the tin. The batter does indeed need to score, hence the word ‘run’, but not even all of these count towards the average. The run must be earned by the pitcher - that is, he was responsible for the man who scored reaching base on a hit, walk, hit by pitch. If the pitcher is not at fault for the man reaching base, for example where a simple throw to 1st would get the batter out on a ground out but the 1st baseman drops it, then if that runner scores, its not earned. Makes sense - not his fault.
Anyway, the number of earned runs he gives up every 9 innings of work (hence the word ‘average’) is his ERA. An ERA of 3.00 means 3 runs score in 9 innings, so 1 run every 3 innings and so on.
Hopefully this is of assistance, but I’ll have to pass this on, regarding the technicalities of earned runs, to someone who’s a real expert.