We present analytical results for the emerging structure of networks that evolve via a combination of growth (by node addition and random attachment) and contraction (by random node deletion). To this end we consider a network model in which at each time step a node addition and random attachment step takes place with probability and a random node deletion step takes place with probability . The balance between the growth and contraction processes is captured by the parameter . The case of pure network growth is described by . In the case that , the rate of node addition exceeds the rate of node deletion and the overall process is of network growth. In the opposite case, where , the overall process is of network contraction, while in the special case of the expected size of the network remains fixed, apart from fluctuations. Using the master equation and the generating function formalism, we obtain a closed-form expression for the time-dependent degree distribution . The degree distribution includes a term that depends on the initial degree distribution , which decays as time evolves, and an asymptotic distribution which is independent of the initial condition. In the case of pure network growth (), the asymptotic distribution follows an exponential distribution, while for it consists of a sum of Poisson-like terms and exhibits a Poisson-like tail. In the case of overall network growth () the degree distribution eventually converges to . In the case of overall network contraction () we identify two different regimes. For the degree distribution quickly converges towards . In contrast, for the convergence of is initially very slow and it gets closer to only shortly before the network vanishes. Thus, the model exhibits three phase transitions: a structural transition between two functional forms of at , a transition between an overall growth and overall contraction at , and a dynamical transition between fast and slow convergence towards at . The analytical results are found to be in very good agreement with the results obtained from computer simulations.