Find the values of $a$ such that $\log (ax+1) = \log (x-a) + \log (2-x)$ has a unique real solution.
1. Start with the given equation:
   \[
   \log(ax + 1) = \log(x - a) + \log(2 - x)
   \]

2. Use the properties of logarithms to combine the right-hand side:
   \[
   \log(ax + 1) = \log((x - a)(2 - x))
   \]

3. Since the logarithm function is one-to-one, we can equate the arguments:
   \[
   ax + 1 = (x - a)(2 - x)
   \]

4. Expand the right-hand side:
   \[
   ax + 1 = 2x - x^2 - 2a + ax
   \]

5. Simplify the equation by canceling out \(ax\) from both sides:
   \[
   1 = 2x - x^2 - 2a
   \]

6. Rearrange the equation to form a quadratic equation:
   \[
   x^2 - 2x + (1 + 2a) = 0
   \]

7. To find the roots of the quadratic equation, use the quadratic formula \(x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}\):
   \[
   x = \frac{2 \pm \sqrt{4 - 4(1 + 2a)}}{2}
   \]

8. Simplify the expression under the square root:
   \[
   x = \frac{2 \pm \sqrt{4 - 4 - 8a}}{2} = \frac{2 \pm \sqrt{-8a}}{2} = 1 \pm \sqrt{-2a}
   \]

9. For the roots to be real, the expression under the square root must be non-negative:
   \[
   -2a \geq 0 \implies a \leq 0
   \]

10. To have a unique real solution, the two roots must be equal, which happens when the discriminant is zero:
    \[
    \sqrt{-2a} = 0 \implies a = 0
    \]

11. However, we need to check the conditions under which \(x = 1 - \sqrt{-2a}\) is the only root. For \(a \in [-1/2, 0]\), the root \(x = 1 + \sqrt{-2a}\) is not valid because it would be outside the domain of the original logarithmic functions.

12. Therefore, for \(a \in [-1/2, 0]\), the equation has a unique real root \(x = 1 - \sqrt{-2a}\).

The final answer is \( \boxed{ a \in [-1/2, 0] } \)