How do people become infected with pid?

By having sex. Pid results from catching a contagious infection, usually through sexual intercourse, but sometime with more "casual" contact. The gonococcus can persist for a while on environmental surfaces, but catching it from "doorknobs" must be exceedingly rare.