Two gears are spinning is opposite directions, I would like a third gear to spin in one direction (the direction is not important), and this third gear must be the sum of the motions of the two gears. The speeds of the two gears can vary. If they were spinning at constant speed, this would be easy for me, however they are always changing.
The device you are looking for is called a differential like @Ethan48 commented. There are two ways of using the differential the typical use is to split one powered shafts power into two separate shafts. This is used in cars and that is the typical place people have heard of the concept.
Given the nature of mechanical couplings it can also be used in reverse to sum the movement of two axes into one. So you can use it to connect two driving shafts into one output.