Most fungal nail infections are caused by dermatophyte fungi, which is the same infection which also cause athlete's foot.
It can easily spread to the toenails.
Ocassionally, a nail infection can be caused by other types of fungi, such as Candida (a yeast that causes infections such as vaginal thrush).
Several factors increase the risk of a fungal nail infection developing.
wearing shoes that cause your feet to get hot and sweaty
being in a humid environment
regular damage to the nail or skin
poor health or certain health conditions, such as diabetes or psoriasis.
poor nail treatments