Why does a plane shake while passing through clouds?
In a word, it's called "Turbulence" and in cloud, it is caused by differing air density.

Sciencey bit: The sun warms the earth and causes the air to rise. As warm air rises, it cools at the wet adiabatic lapse rate. Inside of a cloud, this rate is much slower than outside of it. Clouds are more dense than dry air, and the water vapour inside a cloud is not spread out evenly. Combined with the thermal turbulence (the movement of warm air) and the lower wet adiabatic lapse rate (rate of cooling) results in drafts of air through the cloud. 

The result to the aircraft is pockets of more and less lift on the wings in somewhat unpredictable patterns. You feel this inside the aircraft as bumpiness and occasional feelings of rising or dropping. Sometimes this can be quite pronounced - this is why you will almost certainly be asked to remain seated with seatbelts fastened.

Very occasionally, outside of clouds, there can be more unpredicatable turbulence which may come as a surprise to the Pilot. This type of turbulence can cause injuries - usually from falling luggage or persons. This is why, even during cruise, the cabin crew and pilot usually suggest you keep your belt on while seated.

In almost no case does any kind of turbulence cause any damage to the aircraft or significantly affect its airworthiness.

Another answer here might be interesting reading for you How dangerous was the turbulence on this commercial flight?
as might What is turbulence, and how does it happen?