There is a beautiful article (a write-up of a talk, actually), by E.M. Purcell, Life at low Reynolds number, that explains how bacteria swim.
Low Reynolds number is the technical way to phrase the statement in the OP that motion at that scale feels like moving in a tar pit. InertiaThe governing equation is inoperativethe linearized Navier-Stokes equation, a.k.a. the Stokes equation, which lacks the inertial $v\nabla v$ term. The linearity of the Stokes equation means that the swimming technique which we would use, moving arms or legs back and forth, will not work. Purcell calls this the "scallop theorem": opening and closing the shells of a scallop will just move the object back and forth, without net forward motion.
Inertia can still play a role on short time scales, as explained in Emergency cell swimming.
The way bacteria move in the absence of inertia is the way a corkscrew enters a material upon turning, the cork screw being the flagellum. In fact, any nonsymmetrical object, when turned will propagate in a tar pit. Typical velocities are $1$ mm/min, as Purcell says: "Motion at low Reynolds number is very majestic, slow, and regular."
Here is a visualization of a sperm cell moving by rotating its flagellum (published just this week in Science Advances).
Note that the rotation is only clearly visible in three dimensions. Two-dimensional projections suggest a beating motion (first reported by Van Leeuwenhoek in the 17th century), which is not an effective means of propagation at low Reynolds number.