The issue can have many causes. As the video notes, the most common is a group of fungi known as dermatophytes. Though, there are also a variety of yeasts and molds that can be a cause. The fungi get after dead layers of tissue -- it can also infect your skin or hair follicles -- consuming the protein keratin, more or less. (They actually need sulfites for survival and keratins have the amino acid cysteine, which contains sulfur. If you're interested in the science behind the process, Today I Found Out has a very thorough explanation.)
Your risk of acquiring the fungal infection can increase because of diminished blood circulation, injury to a nail, a history of athlete's foot, a weakened immune system, family history, diabetes, or AIDS. You can also increase the likelihood of infection by walking barefoot in damp communal areas or by having socks and/or shoes that don't allow ventilation. Additionally, men are more likely to be affected by onychomycosis than women.
If you have it and want to treat it, there are options you can discuss with a doctor. They would need to determine the cause and severity before recommending a topical treatment or oral medication.