In the textbook of stochastic process, it says
Suppose there is only one server. Let $L$ be the long-run average number of customers in the system. Let $L_Q$ be the average queue length in equilibrium. The length of the queue is $1$ less than the number of customers in the system, except when the number of customers in the system is $0$. So if $\pi(0)$ is the probability of no customers, then $L_Q=L-1 +\pi(0)$.
This equation confuses me. How could we add a probability to an average number to get another average number? Also, when the number of customers in the system is $0$, the length of the queue should be $0$. Following this logic, we should have $L_Q=(1-\pi(0))\times (L-1)+\pi(0)\times 0$. Furthermore, it seems that $\pi(0)$ might be redundant, because $L$ is already the average number, taking $0$ customer in the system into account.
Could anyone explain a little bit?
They are using the equation $$L(t) = L_Q(t) + 1 - I\{empty(t)\}$$ where $L(t)$ and $L_Q(t)$ are the system size and queue size at time $t$, and $I\{empty(t)\}$ is an indicator variable that is 1 if the system is empty at time $t$, and 0 else. So taking expectations of both sides gives $$E[L(t)] = E[L_Q(t)] + 1 - E[I\{empty(t)\}]$$ and $E[I\{empty(t)\}] = P[empty(t)]$. In steady state this becomes $$ E[L] = E[L_Q] + 1 - P[empty]$$