In this paper, we develop a method of localization in equivariant cohomology based on the notion of partition of unity cohomology. We apply this method in two cases. In the first case, this method gives a refinement of the localization of Atiyah–Bott and Berline–Vergne (in the frame given by Bismut). After, we consider the Hamiltonian action of a torus, and we realise, following the idea of Witten, the localization on the critical points of the square of the moment map.