When this word is used with an infinitive, it is always нужно, as in "Мне нужно пойти домой." Note that one of the satisfying things about Russian grammar--there are many--is that one can say "always."
However, when this word is used with a noun or noun phrase without an infinitive, it is simply a short adjective, and therefore ti takes the endings that other common short adjectives take, such as уверен and доволен.
What may be confusing you in the (clever) sentence above is that the word is used as a short adjective with the noun общество, whose ending marks it as a neuter. Therefore the word is нужно, which happens to coincide in spelling with the word used with infinitives. Remember--the thing to ask yourself is whether the word is used with an infinitive.