How many slots does a shulker box have?
27 slots, the same as a single chest. A double chest has 54, exactly double. How many items fit depends only on the stack size of whatever item is stored.
Why do some items only stack up to 16?
It is a fixed, non-configurable per-item-type game limit: egg, snowball and sign, among others, cap at a 16-item stack instead of the standard 64. Unique items like tools and armor go further, capping at a 1-item stack.
How do I calculate how many chests I need to store N items?
Divide the total quantity by the container's capacity (slots × the item's stack size): a double chest holding stack-64 items fits 3456 units; any remainder above an exact multiple rounds up to the number of full chests actually needed.
How many slots does a stack-1 item use per unit?
One full slot per unit, no exceptions: tools, armor, potions and filled buckets never combine into the same slot, so storing 27 of them already fills an entire shulker box, even though 27 is a small item count.