I think the easiest way to think about it is this : The case where you have $5$ adjacent orange balls is actually just the case where you have $2$ orange-$3$ orange balls, but that those two groups are now sticked together. So replace the original problem by this : You have $n$ red balls, one $2$-group of orange balls and one $3$-group of orange balls, i.e. $3$ types of objects. Therefore there are $\begin{pmatrix} n + 2 \\ n,1,1 \end{pmatrix} = (n+2)(n+1)$ ways to arrange those. But when the orange balls are in a group of $5$, you're double counting, because it is the same thing if you place the group of $2$-orange balls to the left or to the right of the group of $3$-orange balls when they are next to each other, so in this count you remove once the number of cases where the $5$ orange balls are together, which gives you a final count of $ \begin{pmatrix} n+2 \\ n,1,1 \end{pmatrix} - (n+1) = (n+2)(n+1) - (n+1) = (n+1)^2 = n^2 + 2n + 1. $