[Abridged] Snowlines in protoplanetary disks play an important role in planet formation and composition. Since the CO snowline is difficult to observe directly with CO emission, its location has been inferred in several disks from spatially resolved ALMA observations of DCO+ and N2H+. N2H+ is considered to be a good tracer of the CO snowline based on astrochemical considerations predicting an anti-correlation between N2H+ and gas-phase CO. In this work, the robustness of N2H+ as a tracer of the CO snowline is investigated. A simple chemical network is used in combination with the radiative transfer code LIME to model the N2H+ distribution and corresponding emission in the disk around TW Hya. The assumed CO and N2 abundances, corresponding binding energies, cosmic ray ionization rate, and degree of large-grain settling are varied to determine the effects on the N2H+ emission and its relation to the CO snowline. For the adopted physical structure of the TW Hya disk and molecular binding energies for pure ices, the balance between freeze-out and thermal desorption predicts a CO snowline at 19 AU, corresponding to a CO midplane freeze-out temperature of 20 K. A model with a total, i.e. gas plus ice, CO abundance of 3e-6 with respect to H2 fits the position of the emission peak observed by Qi et al. 2013 for the TW Hya disk. However, the relationship between N2H+ and the CO snowline is more complicated than generally assumed: for the investigated parameters, the N2H+ column density peaks at least 5 AU outside the CO snowline. Moreover, the N2H+ emission can peak much further out, as far as ~50 AU beyond the snowline. Hence, chemical modeling, as done here, is necessary to derive a CO snowline location from N2H+ observations.