How do proteins perform their function
This question is waaaay too broad, but I'll give some short and simplified answers to the hypothetical you asked at the end. First, let's reformulate your example a little bit:

How does the ribosome move along a strand of RNA?


How would it do it?


By hydrolyzing GTP and somehow coupling the free energy associated with that reaction to forward motion. Keep in mind that both ribosome and RNA are constantly undergoing random-walk Brownian motion (ie jiggling), so it's more a matter of biasing the ribosome's motion in a particular direction than it is of moving the ribosome in the first place.

What forces would move it along this strand?


The current understanding of molecular biophysics, which is by no means complete, says that the primary driver of this sort of protein activity is electrostatic forces.

Is it electromagnetism? 


There are no electric currents, per se, so magnetism does not play a role.

Would gravity be involved to a significant degree?


At these scales gravity does not have a significant effect.

What effect would shape have?


Shape has an enormous effect. One of the fundamental axioms of molecular biophysics is that function follows form. The 3D configuration of those electrostatic forces I mentioned is determined in turn by the 3D configuration of the involved macromolecules.



If you want to know (a lot) more about this specific question, and if you have access to journals, check out this review: How Should We Think About the Ribosome?