No matter where you put the magnet, it will pass by the sensor once per revolution. That said, at higher speeds, the magnet will be passing the sensor faster, so you may want to position it closer to the hub, because if it's out by the rim it may pass the sensor too fast for it to be registered.
Then again I've seen people using cyclocomputers near the middle of the wheel on their motorcycles with no problems, so the advantages in placement are possibly academic.