Cats are amazingly smart animals, they are also one of the easiest to potty train, heres how....
From Kittens to full grown cats, potty training seems to come naturally to them. Cats WANT to hide and bury their messes, they are very clean animals and once they use the litter box once it is 99 out of 100 times done!
When you first bring a new kitty into your home have a new clean litter box set up for them. Place the litter box where it will be permanently. Cats DO NOT like their bathrooms moved. Sit kitty in the new clean litter and walk away.
They will probably sniff it a little and then walk off. Watch your cat carefully and the first time you see them squat pick them up and set them in the litter box. (NO SPANKING, otherwise they will associate potty with pain, causing all kinds of problems)
After your cat uses the litter box once they will never forget it's location and as long as you keep the litter box clean you will most likely never have a problem with it again. However, there are a few exceptions.
If your cat refuses to use the litter box, change litter brands until he starts using it. Some cats are particularly finicky about their litter. Once you find a brand your cat likes stick with it. Try not to switch brands unless you have to, most cats will give you some trouble if you switch brands often.
Another exception is the shy kitty. Some cats absolutely will not use the bathroom in front of humans. Many times these cats can turn into the kind that use the potty all over your house. To avoid this get kitty a screen or place the litter box in a more private location. It will ease their discomfort and keep them from squatting in any private place they can find.
The next exception is called trauma, Kitty needs to be left alone when he goes potty. If you have children or other pets make sure the litter box is placed well away from them. If your cat gets scared or ran out of the litter box even one time by children or other pets, he will probably stop using it.
The last exception is illness. If you have tried everything and kitty still goes potty all over take him to a vet immediately.
If you have two cats there is a really good possibility for territorial markings, in which the cats will take turns using the bathroom in the same spot trying to get rid of the other cats scent. For this kind of problem, you have several option, spay/neutering helps, and so does the pheromone sprays to help keep them calm.