For calculation of slope and deflection in simply supported beam mainly conjugate beam method is used.
Conjugate beam method: The slope at any section of a loaded beam relative to the original axis of the beam is equal to the shear force in the conjugate beam at the corresponding section.
For Bending moment diagram first calculate reactions at P and Q support

∑v=0
RP = RQ
Taking moment about point Q
RP = 3M/L
RQ = 3M/L
For bending moment diagram- Calculating bending moment from left hand side-
BMP = 0
\(\text{B}{{\text{M}}_{\text{LEFT }!!!!\text{ OF }!!!!\text{ R}}}=-\frac{3M}{L}\times \frac{L}{3}=-\text{M }!!~!!\text{ }\)
\(\text{B}{{\text{M}}_{\text{RIGHT }!!!!\text{ OF }!!!!\text{ R}}}=-\frac{3M}{L}\times \frac{L}{3}+\text{M}=0\text{ }!!~!!\text{ }\)
\(\text{B}{{\text{M}}_{\text{LEFT }!!!!\text{ }OFS}}=-\frac{3M}{L}\times \frac{2L}{3}+\text{M}=-\text{M}\)
\(\text{B}{{\text{M}}_{\text{RIGHT }!!!!\text{ }OFS}}=-\frac{3M}{L}\times \frac{2L}{3}+\text{M}+2\text{M}=\text{M}\)
BMQ=−L3M×L+M+2M=0
Conjugate beam with loading:
Shear at any section of the conjugate beam is equal to the slope of the real beam-
Shear force at P = Reaction at P (RA’) in the conjugate beam

Taking moment about point Q
\(-\text{ }!!!!\text{ R}_{\text{P}}^{\text{ }!!'!!\text{ }}\times \text{ }!!!!\text{ L }!!~!!\text{ }+\frac{1}{2}\times \frac{\text{L}}{3}\times \frac{\text{M}}{\text{EI}}\times \left( \frac{2\text{L}}{3}+\frac{1}{3}\times \frac{\text{L}}{3} \right)+\frac{1}{2}\times \frac{\text{L}}{3}\times \frac{\text{M}}{\text{EI}}\times \left( \frac{\text{L}}{3}+\frac{1}{3}\times \frac{\text{L}}{3} \right)-\frac{1}{2}\times \frac{\text{L}}{3}\times \frac{\text{M}}{\text{EI}}\times \left( \frac{2}{3}\times \frac{\text{L}}{3} \right)=0\)
RP !!′!! × !! !! L=54EI7ML2+54EI4ML2−27EIML2
RP !!′!! =6EIML
\(\therefore \text{Slope }!!!!\text{ at }!!!!\text{ point }!!~!!\text{ P}=\text{R}_{\text{P}}^{\text{ }!!'!!\text{ }}=\frac{\text{ML}}{6\text{EI}}\)