Some tutorials :
http://learnsome.co/blog/particles/
http://thecodeplayer.com/walkthrough/make-a-particle-system-in-html5-canvas
Examples :
http://okeschool.com/examples/canvas/html5-canvas-random-movement
Can use a library to speed up the process :
physics.js : http://wellcaffeinated.net/PhysicsJS/basic-usage
nice demo : http://codepen.io/pen
paper.js : http://paperjs.org/examples/bouncing-balls/