It's easy.You can use LM2907(Frequency to Voltage converter).The output will be directly proportional to the RPM of the motor.There's any specific formulas for this, as the relation is linear.You can calibrate it easily.It gives output in analog voltages.All you need to do is to read them up by your microcontroller.If you don't have ADC built-in your microcontroller, try using ADC0808.This frequency to voltage converter gives output voltage from 0V to -20V.If you want to convert them into positive, you may use OP-AMP as an inverter and invert the polarity.The rest depends on you, what you would do with it.By above method you can easily get the RPM.