how to switch states of animator controller?

such object.animator.animationPlay(“dance”);

I would suggest watching this:

http://video.unity3d.com/video/7362044/unity-40-mecanim-animation-tutorial

and downloading the tutorial project from that link.