Rowling uses Professor Slughorn's expository dialogue to reveal that the creation of a Horcrux requires one to commit a murder, which, as "the supreme act of evil, (...) rips the soul apart." After the murder, a spell is cast to infuse part of the ripped soul into an object, which becomes the Horcrux. Rowling has never published the actual enchantment. In the final book of the series, Hermione Granger finds the spell in a book titled Secrets of the Darkest Art.
Both inanimate objects and living organisms have been used as Horcruxes, though the latter is considered riskier to use, since an organism can move and think for itself. There is no limit to the number of Horcruxes a wizard can create. However, as the creator's soul is divided into progressively smaller portions, he loses more of his natural humanity and his soul becomes increasingly unstable.
Under very specific conditions, a soul fragment can be sealed within an object without the intention or knowledge of the creator. While the object thus affected will, like any Horcrux, preserve the immortality of the creator, it does not become a "Dark object." The only time this is known to have occurred is when Voldemort unsuccessfully used the Killing Curse on one-year-old Harry Potter. Voldemort's body was destroyed by the attempted murder and a portion of his soul was embedded within Harry.
Horcruxes are extremely difficult to destroy. They cannot be destroyed by conventional means such as smashing, breaking, or burning. In order to be destroyed, a Horcrux must suffer damage so severe that repair through magical means would be impossible. (Known specific means for accomplishing this are enumerated and detailed below.) Once a Horcrux is irreparably damaged, the fragment of soul within it is destroyed.
A Horcrux can be magically undone only if the creator goes through a process of deep remorse for the murder committed to create the Horcrux. The pain of this remorse is so excruciating that the process itself may kill the creator.