To achieve a good future in an act of Sonic CD, you must travel to the past and destroy a robot generator. If you do this in both acts 1 and 2, then act 3—the boss act—will also feature a good future.
For the best ending, either collect all the Time Stones found in the special stages or earn a good future in every act. If you gather all the Time Stones, you will enjoy a good future for the rest of the game.