There's a couple threads on anti-tank rifles already, make sure to search to get all info.
Anyway, there's two anti-tank rifles in game - the Boys rifle and the Panzerbuchse. The Boys rifle is bolt-action and comes with 4 clips of 5 shots, the Panzerbuchse is single-shot and comes with 25 rounds. Both rifles have very little bullet drop, in almost all situations you do not need to compensate for bullet drop over long distances, but both rifles are innaccurate (to prevent using them to snip infantry), so it often takes several shots to get a hit on a tank far away. (You can still kill infantry with them, it's just difficult and usually a waste of time).
Both anti-tank rifles are available as pick-up kits all over every map that has anti-tank rifles you can spawn with, and anti-tank rifles are almost always limited to spawn with so please take an unlimited kit (such as rifleman) and then grab a pick-up anti-tank rifle kit if you can.
The spawnable anti-tank rifles:
Allied: knife/Webley/Boys rifle/ x3 sticky bombs
Axis: knife/Walther P38/Panzerbuchse/ x2 3kg geballte ladung
On some maps, spawnable anti-tank rifles include binoculars, but this is rare.
The pick-up anti-tank rifles:
Allied: knife/Webley/Boys rifle/ x2 thermos nukes
Axis: knife/Walther P38/Panzerbuchse/ x2 1kg geballte ladung
The best tactic is to use the alternate anti-tank weapons (sticky bombs, thermos nukes, geballtes) against heavy armor, and use the rifles themselves against light tanks, APCs, trucks, jeeps, etc. A good way to do this is to gain height, such as positioning yourself on the top of a hill, the top floor of a building, etc. This allows you to throw your bombs onto vehicles passing below, as well as using your rifles to shoot vulnerable spots like the top of the turret and engine decks.
Although light tanks are the preferred prey, heavier tanks can be taken out with the rifles (even if your bombs are usually easier). The Panzer III is impervious to anti-tank rifle fire, but the Panzer IV can be killed with 5 shots to the rear of the hull - it's unlikely you will get five shots in, but it's good to know if you see a Panzer IV damaged already, you can kill the tank with a couple quick shots.