Not only does scratching sharpen the claws and remove the old outer husk of the nail, it also feels good. Scratching also serves as a territorial marker. Cats may scratch in preferred sleeping spots or any other place where they spend a lot of time. Doorways and window sills often get scratched, especially when an indoor cat spots an intruder outside. He scratches in a vain attempt to let the other cat know that this is his territory.
Scent is another aspect of territorial scratching.
The sebaceous glands in a cat's paws leave an odor at the scratched area - another way the cat can stake his claim. Cats like to scratch things that are rough so choose a post that is covered in material such as sisal of burlap. Avoid carpet as cats cannot distinguish this from the carpet on the floor. Instead use the underside of the carpet which is rough. Some cats like scratching bare wood or logs covered with bark.