Dividing by 1023 or 1024? The final verdict on analogRead

No matter whether you use 1023 or 1024 the bucket size is the same for each step. 5/1023 or 5/1024.

If you use 1023, then voltage value returned has a progressive shift from returning the minimum value to returning the maximum value. Count = 0 returns 0V for voltages from 0 V to just short of 4.887586mV (5/1023), but count = 1023 returns a value of 5V, and is returned for any voltage from 4.995112 through 5V.

If you follow the datasheet, then each bucket is 5/1024 volts and count = 0 returns 0 V for input voltage up to 4.8828124mV and count = 1023 returns 4.995117V for all input voltages from there to 5V. Using 1024, 5V is never returned; that is what the datasheet is saying.