Probably the two biggest factors are viscosity and rate of shear strain. An example of rate of shear strain is how quickly or slowly force is applied across a deck of cards. They found that if the rate of shear strain is high, the transition threshold is reached at a lower viscosity than if the shear strain rate is low. The converse is also true. If the viscosity of the lava is high, a relatively low rate of shear strain may achieve the transition threshold, and the lava changes to aa.
People often ask if there is a compositional difference between aa and pahoehoe lava.
There is no systematic chemical difference between aa and pahoehoe lava. Lavas with the identical compositions can form both aa and pahoehoe. Lavas that have slight chemical differences tend to have different temperatures and viscosity's but the critical factor influencing the transition from pahoehoe to aa is the viscosity of the lava. Figure 21.11 from Porter, 1987. Pillow lavas are often considered important when trying to decipher old rock sequences because they indicate the presence of water.