In The Matrix, the machines won the war against humans. They have incredibly efficient production and lots of energy.
I think this is basically what @KennyPeanuts is saying, but as I understood it, the machines are surviving. With the sun blocked out by the aftermath of the machine-human war (see The Animatrix), the machines actually rely on the humans for energy. That's why their purpose is bonded so closely: they need the humans to survive.
(You'd think they could just build some solar panels above the clouds, but if you think about the Matrix too much, it doesn't make much sense at all.)