Here's a quick overview of ballistics, using only high school Physics. It's way over-simplified.
When you shoot a gun (a rifle or a pistol, not a shotgun), the bullet goes through three main stages. First it accelerates down the barrel, then it moves quickly through the air, then it smashes into a target. Let's consider those in terms of high school physics.
When you first shoot a rifle, you feel the recoil: the push of the gun back into you as a reaction to the bullet's speeding off. If we think back to high school Physics, what we're feeling there is "conservation of momentum". When we're standing still with a gun, the momentum is zero. If the bullet speeds off, it now has a momentum in one direction, so the shooter and the gun have to have the same amount of momentum in the opposite momentum. They have to add up to the zero momentum they had before the rifle was fired.
So momentum is calculated as the product of mass and velocity:
Of course that works both ways: you can make the recoil feel lighter by using a heavier gun. This is one reason people love the AR-15: the bullets are really fast, but they're not very heavy. The guns aren't super heavy, but the ratio of gun weight to bullet weight means the AR-15 has a much lighter effective recoil than we'd expect.
Once the bullet leaves the gun, it's effectively falling due to gravity and slowing due to air resistance at the same time. Air resistance is more serious Physics than we're going to get into right now – we're not getting into differential equations today! But even from a high school Physics perspective, we understand air resistance well enough to understand that bullet shape has a huge effect.
In the late 19th Century, bullets were more-or-less round-nosed. Modern bullets are generally "Spitzer", or pointy bullets. Of course pointy bullets are more aerodynamic, and slow down less dramatically than round-nosed bullets. So older rounds like the ".30-30" tend to have shorter range than really they should, because the shape really slows them down.
The question of a bullet's effective range is really a question of the bullet's ability to carry the energy it gets in the gun barrel through the air. In an ideal world, a bullet would hit its target at the same speed it leaves the gun barrel. Of course none actually do.
Kinetic energy is calculated as:
When the bullet does hit its target, the measurement we're most interested in is energy. We recall from high school that energy is "the ability to do work". So what we want at the end of the bullet's flight is the maximum possible shedding of energy from the bullet into the target. We want the bullet to do the most possible work on the target in what Physics teachers call a "completely inelastic collision". I suppose the perfect bullet would stop dead at the surface of the target and fall to the ground, completely without energy.
When people talk about "terminal ballistics", they're really talking about how quickly a bullet transfers its energy into the target. Probably the single biggest factor is bullet deformation: when a bullet hits a target, it's rapidly and radically reshaped by the impact. The more dramatically the bullet is reshaped, the more work is done, so the more energy is transferred from the bullet to the target.
This is actually one reason people use hollow point bullets for self defense. A hollow point bullet is extremely prone to reshaping on impact, so it sheds a great deal of its energy very quickly. Because a hollow point loses energy very quickly, it tends not to over-penetrate its target. In other words, the probability of a hollow point going through one target into another is very low. In a self-defense situation, this means it's unlikely you'll hit both the bad guy and the innocent bystander behind him. This is one reason police use hollow point bullets.
Of course, this also means hollow points are easier to stop.
Here's a reasonable explanation of terminal ballistics:
So a bullet goes through three main stages, each with its own unique considerations. A bullet that's preferred for one stage might be less preferred for another (e.g. a bullet with excellent terminal ballistics, generally has inferior "flight" ballistics). Sometimes the bullet's mass (or weight) is the most important thing to consider, sometimes the bullet's speed is the primary consideration. And the firearm itself is important too: a heavier rifle means much less felt recoil, for example.
Even at this over-simplified level, ballistics becomes an extremely fascinating study. And we haven't even discussed accuracy yet...