Once the fungus gets ready to sporulate, it grows into the brain, and releases certain chemicals that guide the ant to climb up plants. As the ant reaches a spot that is ideal for reproduction of the fungi, it gets attached to the stem or leaves, using their mandibles.