First put just enough air back into the tube for it to hold its shape. Then tuck the tube back into the flat tire lining up and replacing the valve stem through the valve hole in the rim.
Index: How to Fix a Flat Tire - Fix Your Own Flat Mountain Bike Tire