The number in the redirected page is the id of the mdl_context record for that user.
Example:
If I go to my picture on my localhost
http://local/user/pix.php/5/f1.jpg
"5" is the ID of my user.
That looks up the context of the user in the mdl_context table and returns the record:
id: 17
contextlevel: 30
instanceid: 5
path: /1/17
depth: 2
Then it uses that id of the context record "17" to build the URL to the image, using this method:
$url = moodle_url::make_pluginfile_url($usercontext->id, 'user', 'icon', null, '/', $image);
So it redirects me to:
http://local/pluginfile.php/17/user/icon/f1