Here's an answer somewhat different from those already given.
Associated to any homotopy pullback square, there's a long exact sequence of homotopy groups often called the Mayer-Vietoris sequence. It comes from weaving together the long exact sequences for, say, the two vertical maps in the square, which have homotopy equivalent homotopy fibers. (This weaving is a standard homological algebra exercise, and appears somewhere in Hatcher's book...)
Now, to build the Mayer-Vietoris sequence in cohomology for a CW complex X written as a union of subcomplexes $X = A\cup B$, just note that the homotopy pushout square formed by $A\cap B$, A, B, and X becomes a homotopy pullback square after applying Map(-, K(G, n)), where G is the coefficient group you're using. The Mayer-Vietoris homotopy sequence is now precisely the M-V sequence in cohomology.
(Annoyingly, for a fixed value of n this only gives you some of the sequence.)
It would be interesting to see a variant of this for homology, maybe using the infinite symmetric product? I suppose the place to look would be the book by Aguilar-Gitler-Prieto, where homology is introduced entirely in terms of symmetric products. The relevant bit seems to be missing from the Google preview.