Lightning Network: How was the maximum allowed HTLCs in flight computed? The maximum acceptable max_accepted_htlcs (maximum number of HTLCs forwarded concurrently) is specified by the BOLTS as being 483.
How was this value chosen ?
The rationale is given in the BOLT #3: for the commitment_signed to be under the maximum message size allowed by BOLT #8 (~65kb), and for the penalty transaction to be able to sweep all HTLCs in one transaction.
Here is a more beginner-friendly explanation of the second part.
The 4000000 Weight Units limitation is the maximum Bitcoin block size limit (link to the BIP).
The 400000 Weight Units limitation is the limit for a transaction to be standard (hence relayed).
The penalty transaction is crucial to the security of Lightning Network channels, so you need a transaction which can be relayed, hence a transaction which size is standard.
But each new HTLC is a two additional outputs to the commitment transactions. Thus two new inputs to the penalty transaction (which spends it). It's an added size (calculated in Weight Units) to the penalty transaction.
So you must restrict the number of in-flight HTLCs to accept (i.e. to add to your commitment transaction concurrently) in order to be sure you can broadcast your penalty transaction if something goes wrong.
Now here is the explanation of the calculation :
max_num_htlcs = (400000 - 324 - 272 - (4 * 53) - 2) / 413 = 966


400000 : the maximum transaction size, cf above
324 : the size of the input corresponding to the commitment transaction output sending funds to you.
272 : the size of the input corresponding to the commitment transaction output sending funds to your peer.
53 : the size of the commitment transaction's non-witness data, this is wy it's timed by 4 to get weight units.
2 : the size of the witness header.
400000 - 324 - 272 - (4 * 53) - 2 : the free room left for adding HTLC inputs
413 : the size to spend an accepted HTLC (used over the size to spend an offered HTLC because it's larger).
(400000 - 324 - 272 - (4 * 53) - 2) / 413 : the maximum number of HTLCs you can accepts so that they can be spent by a penalty transaction which can be relayed by the Bitcoin network.

Because each HTLC creates two outputs, you divide this result by two so :

Thus, 483 bidirectional HTLCs (containing both to_local and to_remote outputs) can be resolved in a single penalty transaction. Note: even if the to_remote output is not swept, the resulting max_num_htlcs is 967; which yields the same unidirectional limit of 483 HTLCs.