Since the JPEG DCT block used is 8x8, how does the method deal with images with dimensions that are not multiples of 8? What kind of padding does it use? How are the 8x8 blocks of the image chosen?
The filling is performed to the right ($[1\,,1\,,3\,,x_1\,,x_2\,,x_3\,,x_4\,,x_5]$) or the bottom ($[1\,,1\,,3\,,y_1\,,y_2\,,y_3\,,y_4\,,y_5]^T$), line by line or column by column. The values, as far as I know, is not fixed, and depend on the encoder.
Remember that blocks are formed on luminance/chrominance transformed images, after color space transformation (RGB>YUV) and chroma subsampling. Images are parsed in raster scan: left to right, top to bottom.
The partly occupied blocks on the right and the bottom are filled into Minimum Coded Units of $8\times8$, see JPEG Minimum Coded Unit (MCU) and Partial MCU:
In the case where there are not enough pixels in a row or column to complete a full tile, a partial MCU is used. A partial MCU is automatically extended to be the size of a full MCU but then the overall image dimensions are used to indicate where to cut off the extra later. This extension is generally done by repeating the last pixel of the row or column as necessary.
From Baseline JPEG:
The image is partitioned into blocks of size 8x8. Each block is then independently transformed using the 8x8 DCT. If the image dimensions are not exact multiples of 8, the blocks on the lower and right hand boundaries may be only partially occupied. These boundary blocks must be padded to the full 8x8 block size and processed in an identical fashion to every other block. The compressor is free to select the value used to pad partial boundary blocks.
This last image is taken from Heiko Schwarz, Source Coding and Compression:
A mere zero-padding can be applied, but the risk of strong artifacts at the borders is very high. For advanced applications, and with more recent image coders, one can benefit from the symmetry in the basis function to extend the image more inherently with symmetry/antisymmetry. You can check for instance On Reconstruction Methods for Processing Finite-Length Signals with Paraunitary Filter Banks , Oct. 1995 (online version).
What if image dimension not a multiple of 8?How padding works?
If the image width and height are not multiple of 8, the image will be padded with zeroes most commonly..
How 8*8 blocks are chosen
The image will be split into 8*8 blocks starting from the first pixel.