How do I create a link to an entry using entry's id? This is a beginner question:

How do I create a link to an entry using entry's id?

I tried several combinations, such as {{ entry.getUrl(my_id) }}, {{ entry.url.id(my_id) }}, etc. but failed to found the correct syntax.
The reason why your example fail is that you are using the entry variable. You are trying to call the function getUrl on the model entry, but the function (or model) doesn't exist yet, and has to be created (fetched).

Example:

You can use craft.entries to fetch the EntryModel, and than output its url:

{% set my_id = 5 %}
{% set entry = craft.entries.id(my_id).first() %}
{{ entry.url }}


If you are in an entry loop, it works the same way:

{% for entry in craft.entries.section('blog') %}
    {{ entry.url }}
{% endfor %}