It depends on two things: which webcam you have and which program you are using. There is no universal answer because the setup lives in the software rather than the hardware.
Install the drivers that came with the camera, then open your chat program's settings and find the video or camera section. Select your device from the list, and a preview should appear. If the preview is black, the camera is either not connected properly or another application is already using it.
Once video is working, audio is configured separately in the microphone settings, which is the step people most often skip.
Tell me the specific camera and the specific program and the answer gets much more concrete. Most issues come down to a driver, a privacy permission, or a device already in use elsewhere.