This question may be a stupid question, but I'm really curious.
After playing games like HL2, GMod, or Angry Bird, and using physics libraries like Box2D, I began to wonder "how a physics engine simulates physics?"
Like lexer and parser are used to understand the code when compiling and ray-tracing is used to render a 3D scene, I think that there's some notions (other than collision detection) which are used in the physics engine to simulate physics, like calculating torque and velocity of a pentagon performing barrel roll.
How does a physics engine actually simulate physics? What notions are used? Is there any 'tutorial' on the web about making physics engine like this one, which demonstrates ray tracing?
Creating a (robust) physics engine is a lot more complicated then it may seem at first. The trick is to fake as much as possible rather than calculate the exact values. As a starting point, this blog post has a great introduction. I think this paper by Thomas Jakobsen is also a good read and introduces certain concepts. This blog also has a few interesting articles explaining the details of integrators and how to manage physics for online games.
Going through the source code of physics engines such as Box2D is a good idea to see implementation, but if you don't know the theory of what they're doing, it can come across as confusing. The reason for this is because of the fact that the theory is often too inefficient to implement in a real time game and so algorithms and techniques are used to strike a balance between realism and speed.
If you're creating your own physics engine because you want to use it in a commercial game, I'd suggest choosing an already existing solution instead. (For example, Angry Birds uses Box2D). However, if you're doing it for the experience and for learning about physics engines, it's certainly something that'll teach you quite a bit about efficiency and smart techniques.