Spend them fast
One of the best ways to protect your resources is to spend them fast on upgrades. By doing so you will prevent other players from stealing them.
Don’t put all resources next to each other
When you put all resources next to each other you might motivate an attacker to attack you and steal them. When you spread out your resources you can discourage attackers from attacking you.
Leave them in the treasury
The resources you leave in your treasury, inside the clan castle, can’t be stolen. If you don’t need them right now then keep them there for protection.
Put them behind walls
Put all the resource storage behind walls. This might discourage people from attacking you and so help you protect your resources.
Learn how to reduce the attacks on your village
By upgrading your defenses, not attacking others so often, or getting a shield, you will get attacked less often and so you will protect your resources.
Protect gold mines and Elixir collectors
Gold mines and Elixir collectors can have lots of uncollected resources. If an attacker attacks those buildings he will easily steal those resources. Make sure you protect those buildings as well. (See How to get free gems in clash of clans?)
Place them near the center
Place the storage buildings and the resource collectors near the center of the village if possible. This will make it harder for an attacker to reach them.
Collect the loot regulary
When you collect the loot regularly you will make sure that no resources are left at the mines/drillers/collectors and so it will become harder for others to steal them.
Don’t upgrade your town hall fast
When you upgrade your town hall fast without strengthening your defenses attackers will find it much easier to break through your defenses and take your resources.
Don’t keep all builders busy for long
When you keep all of your builders busy for a long period of time you are very likely to accumulate resources. This can result in increased attacks, in addition to lost resources. (See How to make a successful attack in Clash of Clans?)