"Since Chicago has grade crossings on its subway, what actions are taken to prevent people from walking on the tracks and getting electrocuted?"
Purple Line: The two grade crossings on this line, in the suburb of Wilmette, have an elaborate protection system. When the crossing gates are up, sections of wire fencing block entry to the right of way. When the gates go down, the fence sections slide to one side to let the train pass.
All the other grade crossings are on much of the Yellow Line and the outer ends of the Brown Line and the Blue Line Cermak Branch. These are protected only with warning signs and "cattle boards", which are wooden angled boards on either side of the running rails, designed to discourage people from walking on the rails.