The first parameter is the route prefix that should be used, the second parameter is an array containing the required variables to build a link related to the route you're using. If you take a look at the thread route prefix (library/XenForo/Route/Prefix/Threads.php, there's a function called buildLink(). By calling XenForo_Link::buildPublicLink('threads', $thread), you are effectively calling the buildLink function within the Threads route.
XenForo uses some standardized url structure that you may be already familiar with. The format is somewhat like this:
But in cases where a parameter is required, such in this thread url, where the thread_id is needed, XenForo supports another commonly used url structure:
If we take this thread url as an example, the above variables would be:
action: empty (default action, which usually means "index")
Anyway, you can even create your own routes with very complex url structures if you ever need to, completely outside of what XenForo already uses. You just need to code the proper route functions to support your url structures