The cause of wearing improper footwear. Shoes that are too tight in the toe box, or shoes that have high heels should be avoided. Wearing shoes of either type can push your toes forward, crowding one, or more of your toes into a space that's not large enough to allow your toes to lie flat inside the shoes.
Hammertoe and mallet toe deformities can also be inherited too, and may also occur even when wearing appropriate footwear. The physical appearance of such toe appears to bend upward in the middle and then, curls down in a hammer-like, or claw-like shape. Your shoes can rub against the raised portion of the toe(s), causing painful corns, or calluses due to frictions. The bottom of the affected toe can press down, creating the mallet-like appearance. Initially, such toes may maintain their flexibility and lie flat when you're not wearing crowded footwear. But as time goes on, the tendons of these toes may contract and tighten, causing your toes to become permanently stiff. Eventually, these affected toes might overlap each other and pushing toward the direction of the big toe. If the pain is too intense (either when wearing shoes, or when walking barefooted), surgery is the only mean to resolve such problem. I had a friend who had his 2nd toe surgically cut-off recently and what a relief when the pain has finallygone, as the other toes were now able to occupy the newly-found empty space.