Basicity of monatomic anions

Stronger bases have higher electron pair availability at the atom accepting H+. Therefore, basicity is higher if the negative charge density is higher at that atom.

Charge density is higher for smaller atoms with higher charge.
N3– and O2– are of similar size; therefore N3- has a higher charge density.
O2– is smaller than S2– ; therefore O2– has a higher charge density.
The monatomic anions Xn– all have higher negative charge density at X than molecules HnX.
Thus for a particular X, the anion is more basic than HnX.
decreasing basicity 
H  
C4– N3– O2– F    
    S2–  Cl 
strong base    Br 
weak base   I

The table shows that the trend in basicities of Xn– is the same as for the basicities of HnX.

Excepting the halide ions, Xn– are strong bases.  These strong bases exist in aqueous solution as a mixture of a protonated form and OH.

N3– and C4– are fully protonated.
N3– + 3H2O → NH3 + 3OH
C4– + 4H2O → CH4 + 4OH
S2– and O2– react with one water.
O2– + H2O → 2OH
S2– + H2O → SH + OH