This is actually a complicated question and more difficult to address than is often thought. In many situations, it may simply be impossible to accurately estimate velocity or position using inertial sensors alone. It is possible under some highly constrained situations and for short periods of time, but there is some deep signal processing required to do it correctly. Simply integrating the acceleration signal to get velocity or double integrating the acceleration signal to get position is not only problematic due to sensor bias and noise, but also because you need to have a good estimation of the orientation of the device so that you can accurately remove the effects of gravity from the accelerometer signal. This task requires a complex fusion of the accelerometer, gyroscope, and magnetometer data and is beyond the scope of what this FAQ entry can provide. Below are references to a couple relevant papers in addition to the ISBN of a standard text on inertial navigation using IMUs is 1563476932. It is available on Amazon.
Bebek, O.; Suster, M.A.; Rajgopal, S.; Fu, M.J.; Xuemei Huang; Çavuşoǧlu, M.C.; Young, D.J.; Mehregany, M.; van den Bogert, A.J.; Mastrangelo, C.H., "Personal Navigation via High-Resolution Gait-Corrected Inertial Measurement Units," Instrumentation and Measurement, IEEE Transactions on , vol.59, no.11, pp.3018,3027, Nov. 2010
Foxlin, E., "Pedestrian tracking with shoe-mounted inertial sensors," Computer Graphics and Applications, IEEE , vol.25, no.6, pp.38,46, Nov.-Dec. 2005
Strapdown inertial navigation technology, ISBN 1563476932