pigs have four feet, so if 20 feet belong to the pigs, there's 5 pigs, because 5x4=20. chickens have 2 feet, so if 6 feet belong to the chickens, there's 3 chickens, because 2x3=6.
There will be 5:3 because pigs have 4 feet each so divide 4 from 20 to get 5, then you divide 2 from 6 because chickens have 2 feet so you put the ratio in order to get 5:3