Expected number of trailing zeros Input
A bound m &lt;= 4294967295.
Output
Consider values sampled uniformly at random from integers in the range 0 to m, inclusive.
Your output should be the expected (average) number of trailing zeros in the binary representation of the sampled value. Your answer should be exact, for example given as a fraction.
Example

m = 0. The answer is 1. 0 will be sampled with prob 1.
m = 1. The answer is 1/2. 0 with prob 1/2 and 1 with prob 1/2.
m = 2. The answer is 2/3. 0 and 2 have one trailing zero.
m = 3. The answer is 1/2. 0 and 2 have one trailing zero.
Python, 36 bytes

lambda m:(m+1-bin(m).count('1'),m+1)

Try it online!
A formula!
$$ f(m) = 1 - \frac{\text{#ones in bin}(m)}{m+1} = \frac{m+1-\text{#ones in bin}(m)}{m+1}$$