When your cat chooses a place to use as a toilet their reasoning is a balance of convenience, cleanliness, somewhere unlikely to be disturbed and somewhere away from the other areas that are already allocated for eating, socialising, relaxing or some other activity.
Getting your cat to use the tray is simply a matter of making the litter tray the most appropriate choice and minimising the suitability of other areas.
Cats can become finicky about their litter boxes so it is important to find a litter box that suits your cat’s requirements.
Similarly, there are several different types of cat litter on the market however the most popular ones are the clumping clay litter and the crystal-based/silica gel litter. You may have to experiment and strike a happy medium between the litter you prefer and the litter your kitty prefers to use.