This is an ant infected by a parasitic fungus of the Cordycep genus. This fungus is interesting because it actually manipulates the behavior of its host in order to increase its own chances of reproducing. Once infected, the ant is forced to climb high up into a tree or nearby plant, where it attaches itself. This strange behavior assures a maximized distribution of spores from the fruiting body that emerges out of the dead insect's body weeks later.
In more detail... The fungus spores first attach themselves to the surface of the ant, where they germinate. They then invade the ant's body through the tracheae, allowing for fine fungal filaments called mycelia to start growing. When the fungus is ready to sporulate, the mycelia grow into the ant's brain, and produce chemicals which act on the brain to alter their perception of pheromones. This makes the ant climb a plant and, after reaching the peak, to clamp its mandibles around a leaf or leaf stem. This becomes the ant's final resting place.
The fungus eats through the brain, killing the host. The fungal fruiting bodies sprout from the ant's head, through gaps in the joints of the exoskeleton. When mature, the fruiting bodies burst and release capsules into the air. These explode on their way down, effectively spreading airborne spores over the area below. These spores infect other ants, completing the fungal life cycle. Depending on the type of fungus and the number of infecting spores, death of an infected insect takes 4 to 10 days.
This video is a clip taken from the BBC Planet Earth documentary: