The switch calculates a hash based on the criteria you define with the algorithm. (l2, L2 and L3, and so on).
Then there is a modulo division performed on that hash. The result of the division defines the physical port. Let's say you have 4 ports in a LAG. If the result is 0, it will use port 1, if it is 1, it will use port 2 and so on. So it looks like this:
r0-p1, r1-p2, r2-p3, r3-p4, r4-p1, r5-p2, r6-p3, r7-p4, r8-p1, r9-p2, r10-p3, r11-p4..........r28-p1, r29-p2, r30-p3, r31-p4
So if the number of active port is a divisor of 32, each port will be statistically equally used. As the size of the packets differ, it is actually just the number of packets for the certain hashes. Also the hash itself is statistically calculated over a large number of flows. Means, the more flows you have, the more equally the distribution is. One particular flow always uses the same physical port. Which also means that one single flow can never have more bandwidth than one physical link in a LAG.