Why was Jamie not punished for killing the mad king?
Ned would have either beheaded Jaime or made him join the Night’s Watch despite Jaime’s actually helping in the rebellion (due to honour), but would have swayed under the influence of Robert and let his ruling stand. Thus Jaime was pardoned of all his crimes and allowed to continue to serve in the Kingsguard.
How old was Jaime when he killed the mad king?
Jaime Lannister was 17 years old when he killed the Mad King. Born in 266 AC alongside Cersei, he killed the Mad King during the Sack of King’s Landing and fall of House Targaryen from power in 283 AC.