I plan to run PVC conduit underground from house to shed. Primary purpose is for a sub-panel in the shed - 4 wires for this. I would also like to run another set of wires "back" from the shed to the house to allow for operating a generator in the shed during power outages and bringing that power to the house. Is it allowed to put both of these wire runs in the same conduit as long as I don't violate the 40% fill rule?
Yes, when dealing with single-phase or split-phase power, you can run up to 3 large circuits in a conduit without needing much math. But aside from all the other amp restrictions, your THHN or THWN-2 wires also cannot exceed this amp restriction:
Copper: 6AWG-60A.... 4AWG-76A... 3AWG-92A... 2-104A... 1-116A... 1/0-136A... 2/0-156A... 3/0-180A... 4/0-208A...
Aluminum: 4AWG-60A... 3AWG-68A... 2-80A... 1-92A... 1/0-108A... 2/0-120A... 3/0-140A... 4/0-164A...
Except you are allowed to round up to the next larger available breaker, so #1 Al is allowed for 100A since they do not make 92A breakers.
As long as a split-phase circuit has 3 live conductors, it counts the same as simple 2-conductor circuits. That's because neutral carries only differential current - any current on the neutral means one of the hots is carrying that much less than its rated current.
Go big or go home!
Upsizing conduit now is ridiculously cheap compared to putting in a new trench later. I would go with 2" schedule 80 PVC with prefabricated wide sweeps if burial depth is not an issue (you'll need to trench 21-24" deep for this), or 2" RMC if you cannot dig down that far (that gets your burial depth down to 9-12" and saves you a wire but at the price of more expensive conduit).
The same holds true for the shed subpanel, for which I'd use a 125A, 24 or 30 space, main breaker panel -- the main breaker in this panel merely provides a disconnecting means for the shed, so it can be oversized without issue.
As to wires
What I'd do is run 6 6AWG THWN-2 wires, color-coded to distinguish between the two circuits involved (black/black/white for the shed and red/red/grey for the generator, for instance), and then a single 8AWG bare copper ground in the case of PVC conduit (if you are using RMC, the conduit is the ground wire). You will need a grounding electrode system at the shed, by the way -- two ground rods driven 8' deep and spaced 6' apart with an 8AWG bare copper wire connecting them to each other and to the panel is typical for a structure like this, but your local electrical inspector may have other ideas if you have adverse conditions (like shallow, rocky soil) present.
You will want to fit an inlet box at the shed to match your generator -- a generator with a 240V/30A outlet uses a L14-30 inlet, while a generator with a 240V/50A outlet uses a CS6365 or CS6375 inlet. That way, you can plug your generator in using a normal generator cord.
Furthermore, when assembling the panel and inlet, you will want to torque all lugs to their manufacturer's specifications with an inch-pound torque wrench or torque screwdriver (the tool to use depends on the torque specification), and you will also need to pull the bonding strap or screw from the panel as it is a subpanel, not a main panel.