A couple years ago, I was living in Uganda and I fought a long war with ants that were trying to colonize my Powerbook G4.
I had an ungrounded inverter and I'd get a small shock every time my forearms would touch the PB until one day, I got shock and it HURT. Looked down and saw a bunch of pissed off ants hanging out by the edge and latch.
I have no idea what it is that attracts them, but I'm pretty sure its not just food. Once they decide that they're going to hang out, they'll come find it, wherever you hide your computer.
I also think they kind of like the heat. Or at least until it gets too hot. Burning ants smell kinda lemony and if you can smell them, you got a problem. By then, you'll notice streams of ants scattering from your computer and attacking anything they can.
I couldn't control them, no matter what I tried. Then I decided to take out the colony. Followed the ants and poured boiling water into it, didn't work. Kero/diesel, nope. Ants came back. Eventually ended up mixing two cans of granule gunpowder with every sweet/sugary powder I could find, mixed them together and poured it into the big holes and let the ants take it in. Left it for a day, then I poured kerosene around the mound, then poured in more gunpowder, then let the kero. A few seconds later, WHUMP!
Problem solved.
Until three days later when the ants showed up AGAIN!
I ended up moving across the hospital grounds and stayed in a patient room the rest of my stay there.