Fitbit trackers that count floors use an altimeter to calculate how many floors you've climbed. An altimeter is a sensor that calculates altitude based on atmospheric pressure. Atmospheric pressure decreases with increasing elevation, so the tracker calculates elevation gain based on the reduction in atmospheric pressure. Your tracker registers a floor when it detects continuous motion combined with an elevation gain of about 10 feet. 10 feet is an average between residential and commercial floor heights.
If you climb a long staircase, you may find that the tracker's floor count doesn't match how many floors you've gone up because the floors in the building are taller than 10 feet. For example, if you climb 4 floors that are 13 feet tall (for a total gain of 52 feet), your tracker might tell you that you've gone 5 floors because it assumes that each floor is about 10 feet.
Note that Fitbit trackers do not count the elevation gains simulated from a StairMaster, inclined treadmill, or other stationary exercise equipment. Because your tracker uses changes in barometric pressure to detect elevation change, it requires that you physically change elevation in order to properly record floors.