See if the castle belongs to a clan
If the castle belongs to a clan then the name of the clan will be written on it. If no name is written then the castle does’t belong to a clan and so it doesn’t have clan troops inside it.
Sometimes you can’t tell
In case the castle belongs to a clan, there is no way to tell whether it has troops or not by just looking. In such a case, you have to try to lure the troops out.
Visit the village first
If you can visit the village first, such as what you can do to people who attacked you, then you can simply click on the castle to know. The castle will display something like 10/35, which means that there are troops taking 10 spaces inside the castle.
Put one unit near the castle
The best way to know whether a clan castle has troops or not is to put one unit near the clan castle in order to lure those troops.
Make sure there are no more troops
In some cases, more clan troops get out of the castle as you get near the castle for the second time. This is why it’s very important that you repeat the test again by deploying another unit near the castle. (See How to Defeat Clan Castle Troops in Clash of Clans)
Avoid castles that are out of range
If the castle is out of the range of your test troops then avoid making the attack. While making that attack, castle troops might suddenly emerge and ruin your attack.
When you press the attack button, all the information about the village will be sent to you. If you can use proxy to decode the packets, you can know whether the castle has troops or not. Note that this might be an illegal act that could get you banned. (See How to level up fast in Clash of Clans?)