How do Goliath enemies work?
There is an Achievement for "Goliath, Meet David - Allowed a Goliath to level up four times before killing him" but I don't know how Goliaths work to figure out how to do this.
When I've come across them before, they seem to attack me until I behead them, then some weird shrunken head atop of stringy neck comes out and they start rushing towards their friends (my enemies) and attack them until there's none left.
So how and why does this happens, and what are the actual Goliath AI rules? How do they "level up"?
When you knock off a Goliath's helmet and the little terrifying David Lynch head comes out, they go berserk and attack everyone. They level up by killing their former allies.
Upon killing enemies, the Goliath will gain experience points and gain levels, becoming even more dangerous. A beneficial aspect of this is that the dropped loot will be better. At the GOD ith level, drops are greatly increased.
An easy way to tell whether or not you've gotten it to a high enough level for the "Goliath, Meet David" achievement is if the Goliath has God in its name.
When you shoot off their helmets they start to Rage. You have a few seconds to kill them (don't, if you want the achievement) and then they turn into Raging Goliaths (their health refills too). Raging Goliaths will kill anything near them, including allies. Stop shooting him once he starts raging and he should ignore you and go for whoever's closest.
Piss off a Goliath who's with a bunch of buddies from a long range; he'll start slaughtering them. You can wound his buddies to help him, but don't kill them. He'll kill normal Bandits with ease, but you might want to soften up Badasses for him.
As he kills them he'll power up and turn into a Baddass, then Super, then God Raging Goliath and get larger each time. He'll need to kill 10 enemies (your enemies, his friends) to get to max level, he'll always be called a God at that point.
Note they're much tougher after they've leveled up, but they drop accordingly better loot, particularly at God level.
You could also just wait for him to flash yellow four times, and then kill him if you want the achievement.