When do supply and demand curves shift?
Supply and demand curves are a function of price and quantity.  If anything else changes other than P or Q that is relevant to the curve, the curve shifts.

For supply, these shifters generally fall into three  categories:  


Technology  
Number of producers
Price of inputs


For demand: 


Number of buyers 
Price of complements or substitutes 
Customer tastes and preferences
Consumer income


If you come up with something that didn't fit into these categories, but is not P or Q, the result is still a shift! You probably just need your imagination to squeeze it into one of these 7 formal categories.  For example, if the supply curve was P=2Q+3, and there was a decrease in the cost of inputs, the demand curve could shift to P=2Q+2.  Note how the price levels are lower at every level of Q.

Changes in supply and demand that are not "shifts" are called "slides along the curve". They are any direct change in P or Q. This is easiest to see with a linear, mathematical example. 

Let us say the government wants to set the price of a product. If P=2Q+3 is the supply, then consider that if you set the price (by law) to be 7, then Q is now 2. The curve remains steady, but we slide along it to get to the new P=7, Q=2 position. From wherever P and Q started (P=12 in the example), we now end at point P=7,Q=2, and the curve remains unmoved along the entire line P=2Q+3.