Optimal PWM frequency to control a DC motor?

timer0 does millis() etc and it only controls pins 5 and 6. timer1 controls pins 9 and 10, timer2 controls 3 and 11.

By default timers 1&2 are only used for PWM only unless you use a library that employs one of them (the Servo library for instance).

As for optimal frequency that depends on the various losses in the system - iron losses in the motor increase with both frequency and current-ripple, switching losses in the H-bridge/controller increase with frequency. Too low a frequency causes higher current-ripple leading to increased winding (copper) losses and can cause annoying mechanical vibration and whining... Many RC motor controllers use 8 or 16kHz PWM BTW