Plot exactly N bounce of a ball
You have to declare a discrete variable to count the events
nevent=5; (*number of bounces*)
NDSolve[{y''[t] == -9.81, y[0] == 5, y'[0] == 0, k[0]== 0,
WhenEvent[y[t] == 0, {y'[t] -> -0.95 y'[t], k[t] ->k[t] + 1}],
WhenEvent[k[t] == nevent, {te = t, "StopIntegration"}]}, y, {t, 0, 50}, DiscreteVariables -> {k} ]
Plot[y[t] /. %, {t, 0, te}]
For completeness we note that you can solve the differential equation exactly (cf. this post on physics.SE):
ξ = .9;
k[t_] := Floor[Log[ξ, (ξ - 1) t + 1]];
y[t_] := 1/2 ξ^k[t] (t - (ξ^k[t] - 1)/(ξ - 1)) - 1/2 (t - (ξ^k[t] - 1)/(ξ - 1))^2
With[{n = 6},
Plot[y[t], {t, 0, (ξ^n - 1)/(ξ - 1)}, PlotRange -> All]
]
(Note: here $\xi$ denotes the coefficient of restitution, and I am working in units where $g=1$ and $v_0=1/2$. See the physics post for the general expression).