Testing general relativity and cosmology with gravitational waves: polarizations, propagation speeds, and backgrounds