Here's a video of a dog shaking and releasing. Some mistake this for dreaming only or feel that the dog is in a terrible situation. However, this is a normal and healthy thing for animals. They know how to take care of themselves. Actually, it is a very healthy and normal things for humans as well but very few of us realize that.
The shaking and movement you see is the body releasing built up stress and tension. It is dissipation of energy. If a body (whether it is an animal or a human) is allowed to remain with the energy trapped inside, all types of health conditions can result in the future because of it. In addition, for humans, if we allow ourselves to connect our consciousness and our body together, this type of dissipation helps to further our intimate awareness of who we really are and what it truly means to be human.
For further reading on this, check out Peter Levine's book, "Waking The Tiger"