Fred Keller, a Republican state representative, defeated Marc Friedenberg, a Democrat and professor at Penn State University, in a special election in Pennsylvania’s 12th Congressional District. Mr. Keller will fill the seat left vacant by Tom Marino, who resigned less than one month into his term.