MIDI notes can be added a few different way in Ardour:
Drawing notes with the mouse requires that a MIDI track exists, and a blank MIDI region has been created in this track.
In either Draw or Internal Edit Mode new notes can be added with a click or drag: a mouse click creates a note at the pointer location (or the nearest grid anchor if grid is enabled), and its duration is one Grid unit. A mouse drag creates the note like a click does, but allows continuously setting the duration of the note until the mouse button is released.
The Step Entry editor allows to enter a melody in sequence along time, using a virtual keyboard and specific controls. It can be a very handy and fast way create MIDI lines, in a kind of typewriter way, all the more when using its different keyboard shortcuts.
The Step Entry window is shown by right clicking the record button in the MIDI track header and selecting Step Entry. This will automatically create a MIDI region to type into at the playhead position, which will automatically expand at each step.
The Virtual MIDI Keyboard — or a real MIDI keyboard plugged in as the tracks input — can be used to record MIDI, as a microphone would record audio.
It can be started by choosing the Window > Virtual Keyboard menu. Exactly like for audio recording, the track(s) must be armed for recording, the main record engaged, then the transport started. As for the Step Entry, a MIDI region will be auto-generated at the playhead position, and expanded as long as the recording lasts.