Here is an illustration of bicubic interpolation, which typically needs 4x4 input pixels to calculate one output pixel:
Figure 1. Bicubic interpolation from 4x4 input pixel values to calculate one output pixel value. a) The output pixel must be located in the greyed area with respect to the input pixels (black dots). b) Four intermediate values (red dots) are independently calculated by interpolating horizontally from each row of four input pixels. c) Using the same interpolation method, the output value (blue dot) is interpolated vertically from the column of four intermediate values.
Each interpolation amounts to a weighted sum of four values, with the weights given by cubic polynomials of horizontal or vertical position within the grey square.
Bilinear interpolation works similarly but only has as input the 2x2 pixels at the corners of the grey square, and the polynomials are linear.
Nearest neighbor interpolation has the grey square centered at a pixel, and simply that pixel value is output.