Ergodic optimization in the expanding case : concepts, tools and applications