Hackable exercise bicycle computer?
Maybe I misunderstood your question, since all answers describe so far how to build a system that measures the pedal RPMs (rounds per minute) of a bike or something like that.

However, you just asked for a bicycle ergometer such as in fitness studios which can be connected to a PC to read its current speed and so on.  Well, that's quite simple.  For instance there are a lot of Kettler ergometers with USB or RS232 port that allow you to connect the ergometer to your PC, send commands from your PC to your ergometer and receive information about your current speed, pedal RPM, pulse, power, ...

Moreover, Kettler uses a very simple, character-based communication protocol in their ergometer devices - or at least in the AX1, E3, E5, Ergorace, X3, X7, and RX7 - that are the devices I heard from users to be compatible to JErgometer, my open source ergometer software written in Java.  By now I did not hear from any user that JErgometer did not work with his/her Kettler ergometer, but well, who knows?

Since JErgometer is licensed under GPLv2 you can use the code in your racing game as long as this game is licensed under GPLv2 too or any compatible license.

Of course you are also welcome to join the project if you like to extend it to a racing game or whatsoever. :-)