For a happy cat and a clean-smelling litter area, your cat's litter box should always be full of fresh litter. Remove soiled litter immediately if possible, and change the litter completely at least once a week. It's also a good idea to wash the box thoroughly with water and dishwashing liquid.
Cats naturally look for a quiet place to urinate and defecate. They also prefer a quiet area of the house where they can use their litter box in private. This spot shouldn't be near the cat's feeding dishes. If you have more than one cat, or a large home, you might consider multiple litter boxes in different parts of the house.
Cats are sensitive to smells and concerned about their hygiene. If their litter box is too dirty, or in a location they dislike, they may find another, less appropriate, location to do their business.
However, out-of-the-box litter behavior can also be a sign of a serious health problem such as a bladder infection. If your cat's litter habits change drastically, and the box is clean and well-placed, consult your vet immediately.