The benefit you get from having a large, well-developed network of professional contacts can not be overestimated. This means you should treat all other researchers you meet, no matter what level of seniority, as potential future (or present) colleagues and network contacts.
- UNDERGRADUATE students should aim to have 'connections' (see below) to at least 1-3 professors, one of which will be your research mentor. But, also make sure to connect to your lab-mates (undergrad and grad students and postdocs!). Try to attend a conference, connect to other students there, or professors who work on similar topics as yours. If you've already conneted to your labmates, they can introduce you to new people.
- GRADUATE students should spend a significant amount of time trying to connect to each faculty in their program and related programs at their university. You have several years to do this; you can use seminars, retreats, receptions, and other events. Make a list of all the faculty whose work relates to yours in some way, and approach them one by one. Connect to your lab-mates (junior and senior). Go to about one conference a year, and make it your goal to meet 2-5 new professors at each one who will remember your name afterwards! But realize that connections who are themselves grad students or postdocs are also valuable, because they can in turn introduce you to others, they can give inside information on other labs and programs, and they may be future colleagues.
- POSTDOCS should already have a well-developed professional network if they followed this advice as grad students (see above). Do the same as you did as grad student at each new institution where you work. But also, you should now be regularly reviewing papers for journals, occasionally publish a conceptual or review paper or organize a symposium at a conference, and in these ways become known to more people in your field. By the time you apply for a faculty position, you want most people in your field to have heard your name.
A 'connection' means that that person knows your first and last name, knows your overall main research interests or the current research question you are working on, and which lab you are in (i.e. the advisor's name).
In order to be an effective 'mentor' or even to be able to write a recommendation letter, a person needs to in addition know what your career plans (at least for the medium-term future) are and what extracurricular or unusual activities you have done that are related to your professional career. So for example if you have participated in or organized outreach events (e.g. events with schoolkids etc.), or if you write for a blog or newspaper, or are in some administrative/representative role (e.g. you are a student representative, you are on a university committee, etc.).
Why do you need these connections? To me, having an extended network of professional contacts is one of the joys of being in science. I love hearing about others' work, meeting these long-time colleagues at conferences, and generally feeling part of a community. So, I think this is an end in itself.
BUT, it is not just that. Being not well known, or known to be a recluse, automatically will reflect badly on you once you apply for faculty jobs (and perhaps before). Good, active departments want to hire great, active faculty, but they also want to imagine that the new faculty will bring reknown, grant money, and fun to the department (actually, see more on this in interviewing). If someone in the department that is considering your application has heard of you or your work, this will give your application a boost that is hard to match with more papers in your file only. Last but not least, eventually you may come up for tenure (the review process that will give you a permanent professor job), and at that time your department will ask for letters about you from very senior people that you don't pick. At least some of them need to have heard of you by then, and ideally should be able to elaborate on the impact of your research on the field. It is much easier to leave the impression that you are great if you meet people earlier in your career.