There are several different ways to create oxygen, but the easiest is by passing an electric current through water to separate the hydrogen atoms from the oxygen atoms. This process is called electrolysis, and is one of the primary ways in which space stations create breathable air for the astronauts. Electrolysis is a relatively easy procedure, which is why it is a common technique for extracting oxygen form water.
Oxygen cannot be produced directly by people; it can only be liberated from the other atoms to which it attaches. This is what happens when electrolysis takes place, although there are other methods by which scientists can remove the oxygen from materials as well. For example, if scientists add an element to an oxide, which is a chemical that contains oxygen, they may be able to release the oxygen from the oxide.
Plants produce oxygen through the process of photosynthesis. In this process, the plants combine solar energy with carbon dioxide and water to produce sugars and oxygen. Oxygen is not usually stable in an atmosphere, and without a constant source to replace that which bonds with other materials, the atmosphere eventually becomes oxygen depleted. This causes many scientists to suspect that any planet with a robust oxygenated atmosphere must have life forms present.