Refitting the back wheel simply means reversing the removal procedure. It’s worth checking the gear alignment, as the cable may settle into a slightly different place.
It only takes a moment at the end of this process to reassure yourself that the adjustment is correct. In the unlikely event that the adjustment has slipped, it will save you the damage that riding on slipping gears does. The key to refitting the back wheel is to get the chain tension correct before you start messing around with the gears. Chain tension is automatically sorted out for you with derailleur gears as the rear derailleur takes up any excess slack in the chain. With a single sprocket, you have to do this as you refit the wheel. It is for this reason that hub gear bikes (and single-speed bikes) have a horizontal dropout.
Step 1: Hold the wheel in the back end of the frame between the chainstays and loop the chain around behind the sprocket. Pull the back wheel back into the dropouts. If you removed any nuts and washers, replace them. On many Shimano hubs, these will be left- and right-specific with a tab that sits in the dropout to hold the axle at the correct angle. Locate the washers neatly in the dropouts. Tighten the wheel nuts by hand.
Step 2: Pull the wheel back in the frame to take up frame slack. It must be straight in the frame, with equal spacing between the tyre and the chainstay on either side. The chain needs to be almost tight. Pedal backwards to find the tightest point and make sure that you can still move the middle of the chain, halfway between the sprocket and the chainring, up and down 1.5cm (1⁄2 in). Tighten both wheel nuts securely. Refit brakes.
Step 3: Before you go any further, check the condition of the gear cable. The outer casing should be free from splits or kinks and should be long enough so that you can turn the bars in both directions without stretching it. Check that the cable pinch nut is tight on the cable. You’ll need two spanners: one to hold the back still, the other to tighten the nut on the front.
Step 4: Before fitting the cable back into the cable stop, take the cable pinch nut and fit it back into the cassette joint. It will only fit into its nest at one particular angle and you’ll have to roll it slightly further anticlockwise than you’d expect. Seat it securely and then route the cable back around the back of the cassette joint. There will be a groove for it to sit in. It should follow a straight path down and around.
Step 5: As and when you removed the cable, pop a thin Allen key into the hole in the cassette joint and roll it around anticlockwise. This should give you enough slack to refit the outer casing back neatly into its cable stop. Shift through the whole range of gears and check that the cassette joint moves around with each click.
Step 6: Finally, check the cable tension. In theory, the hub shouldn’t need adjusting, but in practice the cable often settles back out of place. This has to be done in a specific gear. Look at the shifter – one of the gear indicator numbers will be a different colour to the others. Shift into this one. Check the gear alignment tabs are lined up exactly. If they’re not, use the barrel-adjuster at the shifter, turning it until the tabs are aligned.
Source : BIKE MAINTENANCE TIPS, TRICKS & TECHNIQUES
See also bike maintenance tips, tricks and techniques “Removing hub gear wheels”