You don't need your retainer to stack things, though if you're already there with the retainer's inventory open, you might find it easier/faster that way.

To stack things together in your own inventory (or your retainer's inventory), just click the first stack to pick it up, then click the second stack. If the stacks can be combined (stackable items of the same type that add up to <= the stack maximum), they'll all go into the inventory slot that holds the second stack. If they're on different inventory pages, you can pick the first one up, switch pages (by clicking on the page # button with the mouse or using R1/L1 on the gamepad) while you're still "holding" it, then click the second one.