Basic obstruction theory : where does the obstruction to uniqueness of lifting lie? This is a question about a remark someone said to me without giving much precision. 
Suppose you have two nice spaces $X,Y$ and are trying to build a map $X\to Y$ with certain nice properties. Suppose for simplicity (no pun intended) that $Y$ is a simple space, that is $\pi_1(Y)$ acts trivially on $\pi_n(Y)$ for all $n$.
Then one way to do this is to decompose $Y$ into a Postnikov tower $\dots \to Y_2\to Y_1$. As $Y$ is simple, we can choose each $Y_{n+1}\to Y_n$ to be a principal fibration. 
I was told that the "obstruction to the existence of a lift $f:X\to Y_n$ to $\tilde f : X\to Y_{n+1}$ is a cohomology class in $H^{n+2}(X,\pi_{n+1}(Y))$" and that the "obstruction to the uniqueness of such a lift lies in $H^{n+1}(X,\pi_{n+1}(Y))$". 
I understand the first bit : indeed if we look at a delooping of the fibration $Y_{n+1}\to Y_n$ we see that it is of the form $X_{n+1}\to X_n \to K(\pi_{n+1}(X), n+2)$, therefore if we hace $f: X\to Y_n$, it lifts (up to homotopy) to $Y_{n+1}$ if and only if it is sent to $0$ in $[X, K(\pi_{n+1}(X), n+2)] = H^{n+2}(X, \pi_{n+1}(Y))$, so the obstruction is the class of the pushforward of $f$ in $H^{n+2}(X, \pi_{n+1}(Y))$. 
I have more trouble with the second bit, though. I understand that it is related to the fact that the fiber of the fibration $Y_{n+1}\to Y_n$ is $K(\pi_{n+1}(Y), n+1)$, so if somehow I could "subtract" maps I would definitely get the obstruction where I was told it was; but without that I seem to be stuck :
I have two maps $f_1,f_2 : X\to Y_{n+1}$ that lift $f:X\to Y_n$, what do I do with them ? How do I extract a map $X\to $fiber ? Or perhaps $X\to \mathrm{hofib}$ ?
I thought of focusing on one of the two maps, say $f_1$, fixing $f$ and seeing that a homotopy $p\circ f_1\to f$ (where $p: Y_{n+1}\to Y_n$) gives me a map $X\to$ some space that looks like the homotopy fiber, but I can't make that precise (I would want something like "the homotopy fiber over a point that moves along with $X$")
So my question is :

What is meant by "the obstruction to uniqueness of lifing lies in $H^{n+1}(X,\pi_{n+1}(Y))$" ? 

 A: I'll write $B^n A$ for $K(A, n)$. Given that there exists a lift, the space of lifts is the space of homotopy sections of the homotopy pullback of the bundle $Y_{n+1} \to Y_n$ to $X$ (this follows just from the universal property of the homotopy pullback). The bundle $Y_{n+1} \to Y_n$ is a principal $B^{n+1} \pi_{n+1}(Y)$-bundle whose pullback to $X$ admits a section, hence which is trivializable over $X$. The space of sections of the trivial bundle is the space of functions $[X, B^{n+1} \pi_{n+1}(Y)]$, whose $\pi_0$ is $H^{n+1}(X, \pi_{n+1}(Y))$, and so the space of sections of any trivializable bundle is naturally a torsor over this space. 
(This is a special case of a very general pattern that is straightforward when stated abstractly but surprisingly hard to spot: if $a, b$ are isomorphic, the space of isomorphisms between them is naturally a torsor over the automorphism group of either. "Trivializable" means isomorphic to the trivial bundle, and the space of sections of a principal bundle can be naturally identified with the space of isomorphisms to the trivial bundle.) 
A: Let me write another answer to try to understand this from another point of view and using things I learned recently. 
Let me assume that $X$ is simply-connected and very nice. 
We're back at our stage where we have $X\to Y_n$ and we're asking when we can lift it (uniquely) to $X\to Y_{n+1}$. 
By taking the homotopy pullback of $Y_{n+1}\to Y_n$ along $X\to Y_n$ we get a fibration $P\to X$ with fiber $K(\pi_{n+1}(Y),n+1)$. Let me write $\pi = \pi_{n+1}(Y)$ for simplicity of notation. 
The existence of a lift is equivalent to the existence of a section of that fibration, and then the space of lifts is equivalently the space of sections. 
But now this fibration $P\to X$ is also a (Kan) fibration of $\infty$-groupoids, so in particular I can see it as an $\infty$-functor $X\to \mathcal S$ ($\mathcal S$ is the $\infty$-category of spaces). 
Up to equivalence I may assume that this functor takes a constant value equal to $K(\pi,n+1)$ on objects. 
It follows that we get a functor $\chi : X\to BAut(K(\pi,n+1))$ where by this I denote the full sub-$\infty$-groupoid of $\mathcal S^{\simeq}$ on $K(\pi,n+1)$, which classifies our fibration $P\to X$. Note that the space of sections of that fibration is the space of maps from the constant functor equal to a point to that functor 
So now I have to examine what this space $BAut(K(\pi,n+1))$ is. 
It has one vertex, with mapping space $Map^\simeq (K(\pi,n+1),K(\pi,n+1))$
Therefore its $\pi_0$ is trivial and $\pi_k$ of it is $\pi_0\Omega^k$ of it. $\Omega$ of it is $Map^\simeq(K(\pi,n+1),K(\pi,n+1))$ so we're left with computing the homotopy groups of that thing. 
Its $\pi_0$ is a subset of $H^{n+1}(K(\pi,n+1),\pi) = \hom(\pi,\pi)$ and it's easy to check that it's precisely $Aut(\pi)$.
Then its $\pi_k$ at $id_\pi$ is $\pi_0\Omega^kMap(K(\pi,n+1),K(\pi,n+1)) = \pi_0Map(K(\pi,n+1), K(\pi,n+1-k)) = H^{n+1-k}(K(\pi,n+1),\pi) =$ $\pi$ if $k=n+1$, $0$ else. 
So $BAut(K(\pi,n+1))$ has two homotopy groups : a $\pi_1= Aut(\pi)$, and a $\pi_{n+2} = \pi$. 
Now since $X$ is simply-connected, the map $X\to BAut(K(\pi,n+1))$ lifts to $X\to K(\pi,n+2)$ because of the fiber sequence $K(\pi,n+2)\to BAut(K(\pi,n+1)) \to K(Aut(\pi),1)$
So our fibration is classified by some cohomology class $\alpha \in H^{n+2}(X,\pi)$. More precisely, the space of fibrations of this type is $Map(X,BAut(K(\pi,n+1)))\simeq Map(X,K(\pi,n+2))$
If the fibration has a section, then we get a map of fibrations from $X\to X$ to $P\to X$ which translates to a map of functors $cst_* \to \chi$ and it follows that $\alpha = 0$. 
Therefore the obstruction to lifting is indeed a cohomology class $\alpha \in H^{n+2}(X,\pi)$ (not sure how useful that construction is, though)
Now how about uniqueness ? 
Well if our fibration is known to be trivial, that is, of the form $K(\pi,n+1)\times X$, then the space of sections is $Map(X,K(\pi,n+1))$ (whose $\pi_0$ is indeed $H^{n+1}(X,\pi)$)
More generally, the existence of a map $cst_*\to \chi$ should guarantee the existence of $cst_{K(\pi,n+1)}\to \chi$ because $K(\pi,n+1)$ is a "group". But one would need $\chi$ to be a functor with values in $K(\pi,n+1)$ modules, or, equivalently, $P\to X$ to have a compatible $K(\pi,n+1)$ action. Is that clear ?
It seems to me like this amounts to claiming that any (split ?) fibration $G\to P\to X$ with $G$ an $E_1$-space automatically inherits a (canonical) $G$-action on $P$ which induces the right action on $G$. 
I'll have to think about that, it might be right, but it doesn't seem to be that obvious. 
A: Here's a more lowbrow point of view, with, I think, no gap - as opposed to my previous attempt at an answer . 
The idea is that instead of separating uniqueness and existence, we consider the two similarly, by simply using a relative version of the obstruction to lifting. 
So suppose we have a map $X\to Y_n$, a map (think of it as a cofibration) $A\to X$ together with a lift of $A\to X\to Y_n$ to $Y_{n+1}$. That is, we have a commutative square 
$\require{AMScd}\begin{CD} A @>>> Y_{n+1} \\
@VVV @VVV \\
X @>>> Y_n\end{CD}$
What is the obstruction to filling this diagram with a diagonal map $X\to Y_{n+1}$ ? (up to homotopy, say)
So this is a relative version of the obstruction to existence, but we'll see that it can be adapted to provide obstruction to unicity as well. 
Just as before, if $Y$ is good enough, the Postnikov tower consists of principal fibrations, and in fact, $Y_{n+1}\to Y_n$ is the pullback of the fibration $*\to K(\pi_{n+1}(Y), n+2)$ along some map $Y_n\to K(\pi_{n+1}(Y),n+2)$
It follows that we actually have a larger diagram 
$\require{AMScd}\begin{CD} A @>>> Y_{n+1} @>>> *\\
@VVV @VVV @VVV\\
X @>>> Y_n @>>> K(\pi_{n+1}(Y),n+2)\end{CD}$
Now finding a diagonal filler in the original diagram is the same as finding a diagonal filler in 
$\require{AMScd}\begin{CD} A @>>> *\\
@VVV  @VVV\\
X @>>> K(\pi_{n+1}(Y),n+2)\end{CD}$
by pullback properties. 
But now that diagram corresponds to a map $cofiber(A\to X)\to K(\pi_{n+1}(Y),n+2)$, and if that map is not nullhomotopic, there is no lifting. In fact, the obstruction to getting a diagonal filler is precisely this map; that is, it's a cohomology class in $H^{n+2}(Cofiber(A\to X), \pi_{n+1}(Y))$. 
Now how does this help us ? Well in the $A=\emptyset$ scenario, we get back the non-relative lifting problem, that is, the obstruction to lifting is a cohomology class in $H^{n+2}(X, \pi_{n+1}(Y))$, as initially announced.
What the relative version buys us, though, is that if we take $A= X\times \partial I \to X\times I$ as our cofibration, the problem of finding a diagonal filler is essentially the problem of uniqueness of a lift. That is, if we have two lifts of the same map, they correspond to a diagram 
$\require{AMScd}\begin{CD} X\times \partial I @>>> Y_{n+1} \\
@VVV @VVV \\
X\times I @>>> Y_n\end{CD}$
and a diagonal filler is precisely a homotopy between the two. So the obstruction to such a filler is precisely the obstruction to uniqueness, so it's a cohomology class in $H^{n+2}(X\times I/ X\times \partial I, \pi_{n+1}(Y))= H^{n+1}(X,\pi_{n+1}(Y))$, which is what we wanted. 
(this last equality can be seen from the answer here. The idea is simply that $(X\times I)/(X\times \partial I) = \Sigma(X_+)$, so the reduced cohomology is that of $X$, shifted by one degree)
