Avoid going to an ATM at night. If think you'll need cash, plan ahead, get it during the day in a secure area and neighborhoods known for being safe. Be aware of your surroundings to and from the ATM as well as the avenue of approach of a possible threat or environment a threat might utilize to conceal themselves.
That might sound like common sense, but the one time you say, "Meh, I'll make it quick." might be your first and last mistake.