This is an overview of common concepts that come up while modding. I won't go into any specific code here but a having a general understanding of these will probably make the whole process easier. See the links in each section for resources with additional information. Feel free to skip this and move on to the specific tutorials for your version.
When Forge doesn't provide an event for whatever you're trying to do, you will have to use Mixins instead. They are more complicated to set up but allow you to directly modify Minecraft's bytecode at runtime.