Not having enough litter boxes. (The number of litter boxes should equal the number of cats plus one.)
Dirty litter boxes. (Scoop daily and clean weekly.)
Previous urine marking. (Clean with an enzymatic cleanser.)
Treatment:
Maintain an environment with plenty of litter boxes, food, water, resting areas, perches, and hiding areas.
Some cats respond to seeing cats outdoors by marking, so blocking access to the window or covering the window may help. Use of motion-activated devices such as sprinklers may keep outdoor cats away from your property.
Pheromones can be used to treat urine marking as well. (Ex: Feliway)
A double-blind, placebo-controlled trial found that, after 4 weeks of treatment, cats exposed to pheromones had a significantly lower mean level of marking than cats treated with a placebo.
There are no drugs currently approved for use in treating feline urine spraying; any medication prescribed should be considered extra-label usage.