The easiest way is to use a "resistor divider".
You didn't say what voltage this PIC is running at and therefore the A/D input range is, so let's use 5V for the example. Your input voltage range is 40V, and the output 5V, so you need something that attenuates by at least 8. You also need the result to be centered on 1/2 Vdd, which is 2.5V, whereas your input voltage is centered on 0V.
This can be accomplished with 3 resistors. One end of all three resistors are connected together and to the PIC A/D input pin. The other end of R1 goes to the input signal, R2 goes to Vdd, and R3 goes to ground. The resistor divider is formed by the R1 and the parallel combination of R2 and R3. You can adjust R2 and R3 to center the resulting range at 2.5V, but for simplicity explaining this we'll live with a little bit of assymetry and attenuate a little bit more to make sure both ends are limited to the Vss-Vdd range.
Let's say the PIC wants the analog signal to have a impedance of 10 kΩ or less. Again for simplicity, let's make R2 and R3 20 kΩ. The impedance feeding the PIC will be no more than the parallel combination of those, which is 10 kΩ. To get attenuation of 8, R1 needs to be 7 times R2//R3, which is 70 kΩ. However, since the result won't be exactly symmetric, we need to attenuate a little more to make sure -20V in won't result in less than 0V into the PIC. That actually requires attenuation of 9, so R1 must be at least 8 times R2//R3, which is 80 kΩ. The standard value of 82 kΩ will allow for some slop and margin but you still get most of the A/D range to measure the original signal.
Added:
HereHere is a example of finding the exact solution to a similar problem. This has no assymetry and has a particular specified output impedance. This form of solution can always be used when the A/D range is wholly within the input voltage range.