There are many ways to prepare for racing, an most involve heart rate zones or a power meter. You'll begin with some base mileage, then add in lactate threshold training and intervals. Group rides are also a great way to train.
You've now got some terms to search for, so get to it!