Put the new chain on the largest sprockets front and rear and bring the ends together. (Make sure that it takes the proper path thru the front and rear derailleur and pulleys). This ought to pull your rear derailleur cage until it is parallel with the chainstay (or the ground). Give it some assistance by pulling the chain taught if needed, then lift the chain at the top of the chainring (the front sprocket). You ought to then have between half and full link of additional chain at this point. Mark this length, as this is the length that you install. Another rule of thumb for chain length is this: when you are on the large chainring in front and the tiny cog in the rear, the rear derailleur ought to be straight up and down, or 90 degrees to the ground. An imaginary straight line thru both pulley wheels will be perpendicular to the ground.It will be simpler to then go to smaller sprockets to join the chain at this length as it won't pull as much or be as tight on the smaller sprockets.
Keep in mind not to push the connecting link pin all of the way out while using the chain tool! Also keep in mind that if your chain needs replacement due to age, then you may also require to replace your sprockets . Some chains, such as Shimano 9 speed, also require that you use a new pin every time you take the chain apart.
If your chain is long, it may come off simpler in low gears, or rattle and hit the chainstay. If it is short, it may destroy your freewheel or chainring, or break, while going in to high gear...
Keep in mind that a chain will stretch with use, and when you install a new chain, it may not fit the teeth on the sprockets well. If it doesn't appear to interdigitate smoothly on the chainrings or freewheel, you may require to replace those as well..