Black doesn't have to play 3...a6 (although I do, usually.)
However, the Ruy Lopez uses threats to Black's center early to branch out into other threats, since it's generally a positional opening and usually requires great skill on Black's part against steady pressure to avoid fatal weakening [it's called the "Spanish Torture" for a reason.]
You would be surprised how often the Bb5, ending up on B1 of all places, has played a big role in a White win in many games. Its journey might be Bf1-b5 (center threats) - a5 (maintaining threats) - b3 (threats against f7 or center) - c2 (threats against h7 or to support k-side attacks) - b1 (necessary retreat to avoid elimination or open a square/line for another piece) and finally being the key to mate from b1 or even from its possible final square a2.
Whew, that "Spanish Bishop" gets around! How many other openings have a piece move 5-7 times (Bf1-b5-a4-b3-c2-c1) in the normal scheme of the first 30 moves in some variations, yet be good?
Some players of the black pieces have an absolute fetish about eliminating this bishop, because of its reputation. They play ...a6, ...b5, ...Na5, and ...Nxb3 ASAP, not considering that a2xb3 opens the a-file for the Ra1 (usually a very, very tardy contributer in the Ruy Lopez for White, if at all before the endgame.) However, this gives White a ready-made plan to torture his opponent just the same, if not worse.
Play through a few hundred Ruy Lopez games by good players of the white pieces across time -- instead of looking at opening variations -- and you will see why 3.Bb5 is a good move.
I am pretty partial to the Ruy Lopez opening (playing as white). It's very solid and safe and lets me castle kingside very quickly if I please.
The one thing I've had mixed feelings about though, is bringing the bishop to b5 to threaten the knight on c6. I can't seem to understand the point though, unless you want to exchange. And at that point in the game, your center is solid enough that the knight isn't a huge nuisance and it's way too early to throw away a light square bishop not knowing how valuable it'll be.
It neccesitates black to play a6 but I can't help but think, so what? Most of the time rooks aren't brought out on that file anyway and when they are it's after a pawn or minor piece exchange, so having to play a6 isn't exactly inhibiting black.
Even worse if you play the bishop to a4 and are met with b5. Seems like a lot of wasted development for white if you ask me.
The only downside to white keeping the bishop closer to home is that it gets a little cramped, but it does discourage early checks with how easily it can block attacks on the king or queen.
So, to threaten the knight or to leave it alone?