Due to the considerable secrecy surrounding the process, we can't be certain what factors led to Paul Ryan's selection as Mitt Romney's running mate. But we can speculate, and political scientists are useful in answering this question.
Seth Masket argues the Republican Party's conservative wing had a powerful, while indirect, influence on Romney's choice to pick Ryan.
[I]t seems likely that party forces weighed pretty heavily on Romney's decision. We have some evidence from 2008, for example, that John McCain wanted Joe Lieberman to be his running mate, but that McCain's advisers rejected this because the party would never accept it. That is, there was considerable fear that party activists would abandon the ticket if it had a pro-choice lifelong Democrat on it, and would either stay home or back a more conservative third-party ticket instead. So McCain made his famous game-changing pick. Not many members of the GOP were in the room when he did that, but the party's influence in limiting his choices was considerable.
Romney, like McCain, has been concerned about retaining the support of conservative activists given his own (recent) past with moderation, and he wanted a running mate who would remove some of the doubts about his ideological purity. Ryan has become the darling of fiscal conservatives and many in the Tea Party movement over the past few years, and tapping him sent a signal to those parts of the GOP that Romney takes their concerns very seriously and is willing to tie his fate to theirs. Romney may well have made this decision on his own, but partisan actors certainly played a very powerful role in constraining that decision.