The spores of the fungus attach themselves to the external surface of the ant, where they germinate. They then enter the ant’s body through the tracheae via holes in the exoskeleton called spiracles. Fine fungal filaments called mycelia then start to grow inside the ant’s body cavity, absorbing the host’s soft tissues but avoiding its vital organs.
When the fungus is ready to sporulate, the mycelia grow into the ant’s brain. The fungus then produces chemicals which act on the host’s brain and alter its perception of pheromones. This causes the ant to climb a plant and, upon reaching the top, to clamp its mandibles around a leaf or leaf stem, thus securing it firmly to what will be its final resting place.
Quoted from (click link to learn more): http://neurophilosophy.wordpress.com/2006/11/20/brainwashed-by-a-parasite/