To combine 2 DC power sources, you can diode OR them both together. You can't just directly connect them together because their voltage outputs may differ ever-so-slightly, leading to imbalanced currents as well, causing one generator to try and kill the other by driving current into it.
To passively balance the two DC sources, you can add 2 small (small resistance, high power) resistors, one in series with each of the loads, before or after the diode, before the junction of the two.
To actively balance the two DC sources you can use a microcontroller and control logic to PWM the side delivering more current until it delivers identical current to the side delivering less.
But...how the heck do you combine two AC power sources? It seems to me you'd have to synchronize the AC waveforms somehow. Let's look at solar panels on your roof. I hear some microinverters require "5 minutes to synchronize with your house mains power", meaning somehow they are doing this. But, how do you combine the two? If you put one AC wave from the house at 110V RMS on top of another AC wave from the solar panel at 110V RMS, you'd double the amplitude to an RMS of 220V, which seems wrong. If you put them out-of-phase you've just neutralized the AC mains power in your house, not added to it....so I don't get it. I have no idea how this works, how to approach the problem, or even how to conceptualize or think about the problem.