Calculated by theory: about 80 g of carbohydrate per hour (up to 90 g/h for long races). On the bike what is in the bottles is counted first and gels make up the rest, while when running only gels are counted.
In theory you need 300 to 600 mg of sodium per hour, and we use the middle for the calculation: 450 mg per hour. At 25 °C or warmer you need 500 to 800 mg per hour, because you sweat more, so 650 mg per hour is used. The sodium from the gels is subtracted from that: a gel has about 2.2 mg of sodium for every gram of carbohydrate (a 23 g gel has about 51 mg of sodium). This is an estimate, and the exact value is on the pack. What is left is what you need to take in through a drink, electrolyte capsules or food.
Try it in training, never for the first time on race day.