How is gay used in a sentence as a noun?

The word 'gay' is not a noun, it is an adjective, a word used to describe a noun.

The noun form of the adjective 'gay' is gaiety.

Example sentence:

Sounds of gaiety from the party could be heard in the street below.