ZnO nanowires are excellent candidates as building components for a novel generation of miniaturized electronic circuits, which can be exploited in particular as UV photodetectors and gas sensors. However, the large-scale applicability of ZnO nanowire devices is currently hindered by the limited control over their electrical properties. This thesis addresses in particular three main issues, which are discussed in distinct chapters: 1) the determination of the defect states in such devices and their impact on the below band gap photoconductivity, 2) the origin of the persistent photoconductivity after UV excitation, 3) the impact of doping by ion beam implantation as well as thermal annealing and plasma treatments on the photoconductivity and the detection of hydrogen molecules. 1) The analysis reveals the contribution of interfacial levels located between the nanowire and the gate oxide to the below band gap photoconductivity. Furthermore, in ZnO nanowire based field effect transistors the gate voltage can control the occupation of such defect levels. 2) A quantitative model is proposed, in order to investigate the recombination dynamics of the photogenerated charge carriers. The model is based on the so-called Elovich equation, which describes the adsorption of oxygen molecules on the nanowire surface and the simultaneous trapping of photogenerated electrons. 3) Doping by implantation of aluminum ions induces a drastic enhancement of the persistent photoconductivity, which is caused by the generation of defect levels during the implantation process. Plasma treatments in argon and oxygen atmospheres lead to vanishing hydrogen sensitivity, while thermal annealing in oxygen has a beneficial effect. The optimization of the thermal annealing conditions is also discussed.