Ingrown toenails happen when the toenail has become cracked or frayed, forming sharp spikes that push into the skin and set up an infection.
When feet are hot they produce a lot of sweat. When feet spend a lot of time inside shoes (especially inside joggers and ‘sneakers’ with synthetic socks), the hot sweaty environment softens the toenail, making it more likely to break and form spikes. This provides an ideal environment for infection to start.
Tight shoes, which press the skin at the side of the nail onto the sharp spike, also make the situation worse. Until the nail grows long enough so that the end is beyond the skin at the end of the toe, infections can come back even when they are treated.