A couple of things...you never can use all of the hot water in the tank before it starts to get diluted and cool off. It helps that you draw it from the top, and there is a heating element up there on most of them to maximize how much you can draw, and that you add the water towards the bottom via the dip tube, but you'll never get 40-gallons of same temp, hot water out of a 40-gallon tank. Rough rule, maybe 75-80% of its volume. Second, the do make segmented, bendable anode rods specifically for situations where you don't have enough room to use a straight one. Running the tank hotter and using a tempering valve makes the tank 'look' bigger, but the bigger the temperature difference with the ambient, the higher the standby losses. I'm sure there have been studies on quantifying that, but I've not looked.
The surface area of a 50g tank may not be 25% higher than a 40g tank, so given the same levels of insulation, the difference in standby losses is probably small.