Inversions occur due to double-strand breaks in the chromosome followed by incorrect rejoining of the broken ends. Factors such as exposure to radiation, certain chemicals, and errors in DNA replication can lead to these breaks. Non-homologous end joining (NHEJ) is one mechanism that cells use to repair these breaks, but it can sometimes lead to inversions.