How can I prevent spices from lumping together?
The spice powder clumps together because it has been exposed to moisture.   Carbohydrates or proteins in the spice dissolve a small amount, becoming sticky, causing the granules to stick together. 

To prevent this, keep your spices quite dry:


If you buy in bulk, consider transferring some to a "currently being used" container, and leaving the rest away from the stove with its steam, and any other sources of moisture, well sealed against the humidity (and oxygen) in the air.  This will protect the bulk of your supply, even if the working container gets a little clumpy.
Use good quality, air tight containers for your spices.  I like to buy mine from the same vendor I buy spices from, but of course there are a myriad of options.
Add a food safe desiccation packet to the container.


I use the first method two methods, and have only had clumping in very old working spice jars that probably should have been discarded for having lost their flavor over time anyway.

Often, the clumps are quite fragile--banging the container on the counter a few times will often free up a bit, but it's a mechanical process.  The fork twisting is a good method to free up some for use.  As nicoleets hinted at, if your spice is clumpy, it is a sign that it has been exposed to the environment, and water and air have gotten in.  It may have also declined in flavor.

I wanted to add the "put some rice in the container" method, as one might for sugar or salt, but I cannot find any easily accessible evidence if this is a myth or if it really works.  After all, why should the rice be more likely to absorb water than the spice itself, when the spice has far more exposed surface area?