Some things to try.
You should reset the camera just in case you have inadvertently set something that may be causing the problem.
The reset is in the menu (setup section).
If you can't find it, get out the User Manual and find it.
Then think about the battery.
Recharge the battery and make sure that the charge cycle looks normal.
The charge light blinks to tell you how much it is charged.
Since the camera sometimes works, it can still be a failing battery.
The 20D was introduced in Aug of 2004.
Batteries don't last forever.
Unfortunately, the only way to rule out the battery as the source of the problem is to replace the battery.
Some other things to try:
Use a different memory card.
Use a different lens.
..
I know it is old but it is what I have and can afford right now and it works, well not all the time.
It will take pictures, sometimes, but often-maybe more often than not- it will focus and do everything it should, but just not take the picture. Any ideas?

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic